rendered paste body#!/usr/bin/env python
import sys
from qt import *
import LCDRange
import Cannon
class MyApp(QApplication):
def __init__(self, args):
QApplication.__init__(self, args)
self.w = QVBox()
self.w.resize(500,355)
self.addWidgets()
self.setMainWidget(self.w)
self.w.show()
self.exec_loop()
def addWidgets(self):
self.quit= QPushButton("Quit", self.w, "quit")
self.quit.setFont(QFont("Times",18,QFont.Bold))
self.connect(self.quit, SIGNAL("clicked()"), self, SLOT("quit()"))
self.angle = LCDRange(self,"angle")
self.angle.setRange(5,70)
self.cannonField = CannonField(self, "cannonField")
self.connect(angle, SIGNAL("valueChanged(int)"), cannonField, SIGNAL("setAngle(int)"))
self.connect(angle, SIGNAL("angleChanged(int)"), cannonField, SIGNAL("setValue(int)"))
self.grid = QGridLayout(this, 2, 2, 10) #2x2 10px border
self.grid.addWidget(self.quit,0,0)
self.grid.addWidget(self.angle, 1, 0, Qt.AlignTop)
self.grid.addWidget(self.cannonField, 1, 1)
self.grid.setColStretch(1,10)
self.angle.setValue(60)
self.angle.setFocus()
if __name__ == "__main__":
app = MyApp(sys.argv)