Mercurial > fife-parpg
comparison demos/pychan_demo/dynamic.py @ 378:64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
author | vtchill@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Mon, 11 Jan 2010 23:34:52 +0000 |
parents | |
children | 70697641fca3 |
comparison
equal
deleted
inserted
replaced
377:fe6fb0e0ed23 | 378:64738befdf3b |
---|---|
1 # -*- coding: utf-8 -*- | |
2 | |
3 from fife.extensions import pychan | |
4 from pychan_test import PyChanExample | |
5 | |
6 class DynamicExample(PyChanExample): | |
7 def __init__(self): | |
8 super(DynamicExample,self).__init__('gui/dynamic.xml') | |
9 | |
10 def start(self): | |
11 self.widget = pychan.loadXML(self.xmlFile) | |
12 self.widget.mapEvents({ | |
13 'okButton' :self.stop, | |
14 'addButton' :self.addLabel, | |
15 }) | |
16 self.labelBox = self.widget.findChild(name="labelBox") | |
17 self.widget.show() | |
18 | |
19 def addLabel(self): | |
20 # Code to check text wrapping code in FIFE | |
21 label = pychan.widgets.Label(max_size=(200,1000),wrap_text=True) | |
22 label.text = self.widget.collectData('labelText') | |
23 label.capture(self.removeLabel) | |
24 self.labelBox.addChild( label ) | |
25 self.widget.adaptLayout() | |
26 | |
27 def removeLabel(self,widget=None): | |
28 widget.parent.removeChild(widget) | |
29 self.widget.adaptLayout() |