diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/demos/pychan_demo/dynamic.py	Mon Jan 11 23:34:52 2010 +0000
@@ -0,0 +1,29 @@
+# -*- coding: utf-8 -*-
+
+from fife.extensions import pychan
+from pychan_test import PyChanExample
+
+class DynamicExample(PyChanExample):
+	def __init__(self):
+		super(DynamicExample,self).__init__('gui/dynamic.xml')
+		
+	def start(self):
+		self.widget = pychan.loadXML(self.xmlFile)
+		self.widget.mapEvents({
+			'okButton'   :self.stop,
+			'addButton'  :self.addLabel,
+		})
+		self.labelBox = self.widget.findChild(name="labelBox")
+		self.widget.show()
+
+	def addLabel(self):
+		# Code to check text wrapping code in FIFE
+		label = pychan.widgets.Label(max_size=(200,1000),wrap_text=True)
+		label.text = self.widget.collectData('labelText')
+		label.capture(self.removeLabel)
+		self.labelBox.addChild( label )
+		self.widget.adaptLayout()
+		
+	def removeLabel(self,widget=None):
+		widget.parent.removeChild(widget)
+		self.widget.adaptLayout()