python - Trigger QLabel text update with QPushButton -
so i've tried read on , baffled! essentially, want modify text
variable of label
class function in button
class. both label
, button
classes instantiated within class ui_form
. i've cut out code possible example.
class button(qtgui.qpushbutton): def __init__(self, iconpath, iconx, icony, posx, posy, posa, posb, objname, parent=none): super(button, self).__init__(parent=parent) def editlabel(self): self.filename = ntpath.basename(self.samplepath) edit label class here! class label(qtgui.qlabel): def __init__(self, text, posx, posy, posa, posb, objname, parent=none): super(label, self).__init__(parent=parent) self.setgeometry(qtcore.qrect(posx, posy, posa, posb)) self.font = qtgui.qfont() self.font.setpointsize(10) self.setfont(self.font) self.setobjectname(objname) self.text = text self.settext(qtgui.qapplication.translate("form", "<html><head/><body><p align=\"center\"><span style=\" color:#ffffff;\">"+ self.text +"</span></p></body></html>", none, qtgui.qapplication.unicodeutf8))
the instances of classes created in yet class..
class ui_form(qtgui.qwidget): def __init__(self): qtgui.qwidget.__init__(self) self.setupui(self) def setupui(self, form): form.setobjectname("form") form.resize(591, 591) self.btn_a1 = button("python/lp_proj/lp_circle_off.png", 49, 49, 30, 40, 41, 41, "btn_a1", self) self.lab_a1 = label("unassigned", 20, 76, 61, 16, "lab_a1", self)
Comments
Post a Comment