Rapidly build GUI with Python and Qt
The above code construct a dialog, waits for the user input and return window contents in a namedtuple
.
from PyQt4.QtGui import QApplication
from simplewidgets.fields import LineTextField, IntField, ChoiceField
from simplewidgets.simplewidget import SimpleDialog
class DemoDialog(SimpleDialog):
name = LineTextField(label="Name")
age = IntField(30, label="Age")
gender = ChoiceField(["Male", "Female"], initial="Female", label="Gender")
app = QApplication([])
demo = DemoDialog()
if demo.exec_accepted():
data = demo.get_data()
print data
>> SimpleData(name=u'', age=30, gender='Female')