python - How can I make a white box in PyQt? -
i have pyqt application has widget called deck
class deck(qtgui.qwidget): def __init__(self, filename, parent): super(deck, self).__init__(parent) self.setminimumsize(100, 150) self.setstylesheet('background-color: white;') label = qtgui.qlabel("deck", self) label.show()
i expected deck widget white, under label, although accepts clicks on 100x150 area , adjusts hbox:s size.
edit: surrounding layout.
import sys pyqt4 import qtgui app = qtgui.qapplication(sys.argv) #import qt4reactor #qt4reactor.install() deck import deck class duel(qtgui.qwidget): def __init__(self): super(duel, self).__init__() toparea = qtgui.qhboxlayout() toparea.addstretch(1) d = deck(sys.argv[1], self) d.show() toparea.addwidget(d) bottomarea = qtgui.qhboxlayout() d = deck(sys.argv[2], self) d.show() bottomarea.addwidget(d) bottomarea.addstretch(1) vbox = qtgui.qvboxlayout() vbox.addlayout(toparea) vbox.addstretch(1) vbox.addlayout(bottomarea) self.setlayout(vbox) def main(): root = duel() root.show() app.exec_() if __name__ == '__main__': main()
Comments
Post a Comment