コード例 #1
0
ファイル: qt_test.py プロジェクト: Subwayway/SmartMirror
 def weather_update(self):
     weather_crawling.weather_read('성남시')
     self.weather.setText(weather_crawling.location + " " +
                          weather_crawling.temp + "˚ " +
                          weather_crawling.climate[0])
     self.weather_img.setPixmap('image_sample/' +
                                weather_crawling.climate[0] + '.png')
コード例 #2
0
ファイル: qt_test.py プロジェクト: Subwayway/SmartMirror
    def TestStack1(self):
        #현재시간 라벨
        self.TC = QDateTime.currentDateTime()
        self.TimeClock = QLabel(self.TC.toString("yyyy-MM-dd hh:mm:ss"))
        self.TimeClock.setFont(QFont('휴먼모음T', 30))
        self.TimeClock.setStyleSheet("color: white;")
        self.TimeClock.setAlignment(Qt.AlignCenter)

        #날씨 라벨
        weather_crawling.weather_read('성남시')

        self.weather = QLabel(weather_crawling.location + " " +
                              weather_crawling.temp + "˚ " +
                              weather_crawling.climate[0])
        self.weather.setFont(QFont('휴먼모음T', 20))
        self.weather.setStyleSheet("color: white;")

        img_weather = QPixmap('image_sample/' + weather_crawling.climate[0] +
                              '.png')
        self.weather_img = QLabel()
        self.weather_img.setPixmap(img_weather)

        #뉴스 라벨
        news_crawling.news_update()

        self.news1 = QLabel(news_crawling.news_value)
        self.news1.setFont(QFont('휴먼모음T', 15))
        self.news1.setStyleSheet("color: white;")

        #레이아웃
        weather_layout = QVBoxLayout()
        weather_layout.addWidget(self.weather)
        weather_layout.addWidget(self.weather_img)

        news_layout = QVBoxLayout()
        news_layout.addWidget(self.news1)

        weather_news = QHBoxLayout()
        weather_news.addStretch(1)
        weather_news.addLayout(news_layout)
        weather_news.addStretch(10)
        weather_news.addLayout(weather_layout)
        weather_news.addStretch(1)

        stack1_layout = QVBoxLayout()
        stack1_layout.addStretch(1)
        stack1_layout.addWidget(self.TimeClock)
        stack1_layout.addStretch(1)
        stack1_layout.addLayout(weather_news)
        stack1_layout.addStretch(10)

        self.stack1.setLayout(stack1_layout)
        self.swUI.addWidget(self.stack1)
コード例 #3
0
    def TestStack1(self):
        #현재시간 라벨
        self.TC = QDateTime.currentDateTime()
        self.TimeClock = QLabel(self.TC.toString("yyyy-MM-dd hh:mm:ss"))
        self.TimeClock.setFont(QFont('휴먼매직체', 30))
        self.TimeClock.setStyleSheet("color: white;")
        self.TimeClock.setAlignment(Qt.AlignCenter)

        #날씨 라벨
        weather_crawling.weather_read('성남시')

        self.weather = QLabel(weather_crawling.location + " " + weather_crawling.temp + "˚ " + weather_crawling.climate[0])
        self.weather.setFont(QFont('휴먼매직체', 20))
        self.weather.setStyleSheet("color: white;")

        img_weather = QPixmap('image_sample/'+ weather_crawling.climate[0] +'.png')
        weather_img = QLabel()
        weather_img.setPixmap(img_weather)

        box1 = QHBoxLayout()
        box1.addStretch(10)
        box1.addWidget(weather_img)
        box1.addStretch(1)

        box2 = QHBoxLayout()
        box2.addStretch(8)
        box2.addWidget(self.weather)
        box2.addStretch(1)

        textstack1 = QVBoxLayout()
        textstack1.addStretch(1)
        textstack1.addWidget(self.TimeClock)
        textstack1.addLayout(box2)  # weather text layout
        textstack1.addLayout(box1) # weather img layout
        textstack1.addStretch(10)

        self.stack1.setLayout(textstack1)
        self.swUI.addWidget(self.stack1)