[PyKDE] Draw Label in a grid
    Phil Thompson 
    phil at riverbankcomputing.co.uk
       
    Wed Jan 24 18:11:38 GMT 2007
    
    
  
On Wednesday 24 January 2007 5:58 pm, simon stockes wrote:
> The code below is supposed to draw
>
> import sys
> from PyQt4 import QtGui, QtCore
>
> class MainWindow(QtGui.QMainWindow):
>
>     def __init__(self, *args):
>         QtGui.QMainWindow.__init__(self)
>         self.setWindowTitle("DE")
>         self.gridlayout = QtGui.QGridLayout()
>         self.gridlayout.setMargin(9)
>         self.gridlayout.setSpacing(6)
>         self.gridlayout.setObjectName("gridlayout")
>         self.gridlayout.addWidget(QtGui.QLabel("foo",self),0,1)
>         self.gridlayout.addWidget(QtGui.QLabel("fAn",self),0,2)
>
> def main(args):
>     app=QtGui.QApplication(args)
>     win=MainWindow()
>     win.show()
>     app.connect(app, QtCore.SIGNAL("lastWindowClosed()")
>                                  , app
>                                  , QtCore.SLOT("quit()")
>                                  )
>     sys.exit(app.exec_())
>
> if __name__=="__main__":
>     main(sys.argv)
You haven't added the grid layout to the main window.
Phil
    
    
More information about the PyQt
mailing list