[PyQt] QTableView
Taylor Carrasco
crackerbunny at gmail.com
Wed Sep 9 04:35:22 BST 2009
In Python and Pyqt - I've got a simple class which instantiates a Label
class and a GroupBox class.
Should passing the Groupbox to the Label upon creation should make the
Groupbox the parent of Label?
When I create the GroupBox it's fine, when I create the Label however - it
appears distorted (or perhaps behind the GroupBox?)
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import sys
class FileBrowser(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
self.setGeometry(0, 0, 920, 780)
self.initClasses()
def initClasses(self):
# GroupBox
self.groupBox1 = GroupBox(self, QRect(20, 10, 191, 131), 'Shot Info')
# Label
self.labelGroup1_ShotInfo = Label(self, QRect(10, 26, 52, 15), 'Film')
class GroupBox(QWidget):
def __init__(self, parent, geo, title):
QWidget.__init__(self, parent)
obj = QGroupBox(parent)
obj.setGeometry(geo)
obj.setTitle(title)
class Label(QWidget):
def __init__(self, parent, geo, text):
QWidget.__init__(self, parent)
obj = QLabel(parent)
obj.setGeometry(geo)
obj.setText(text)
def main():
app = QApplication(sys.argv)
w = FileBrowser()
w.show()
sys.exit(app.exec_())
if __name__ == "__main__":
main()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090909/759996f4/attachment.html
More information about the PyQt
mailing list