PyQT标签截止

时间:2017-05-28 21:39:01

标签: python pyqt

我正在使用PyQT lib处理Sonos控制器。

当我更改为netxt或prev track时,标签会更新为艺术家,标题和专辑信息。他们被切断了。以前有人经历过吗?这不是一个长度问题,因为切断似乎发生了变化。 enter image description here

enter image description here

enter image description here

这是我用以下代码更新标签的代码:

def currentTrackInfo(self):
    currentTrackInfoDict = {}
    currentZone = str(self.cb.currentText())
    deviceDict = self.sonosZonesCoordinatorsIP()
    for key, value in deviceDict.items():
        if value == currentZone:
            device = SoCo(key)
            track = device.get_current_track_info()
            current_title = track['title']
            current_artist = track["artist"]
            current_album = track["album"]

    currentTrackInfoDict.update({"current_title": current_title})
    currentTrackInfoDict.update({"current_artist": current_artist})
    currentTrackInfoDict.update({"current_album": current_album})

    self.artImage()

    return currentTrackInfoDict

def updateTrackInfo(self):
    self.artistlabel.clear
    self.albumlabel.clear
    self.titlelabel.clear
    self.currentTrackInfoDict = self.currentTrackInfo()
    self.artistlabel.setText("{}".format(self.currentTrackInfoDict["current_artist"]))
    self.albumlabel.setText("{}".format(self.currentTrackInfoDict["current_album"]))
    self.titlelabel.setText("{}".format(self.currentTrackInfoDict["current_title"]))

0 个答案:

没有答案