File: python.e

package info (click to toggle)
entity 0.7.2-6
  • links: PTS
  • area: main
  • in suites: woody
  • size: 5,352 kB
  • ctags: 5,272
  • sloc: ansic: 61,707; sh: 7,921; makefile: 732; perl: 399
file content (40 lines) | stat: -rwxr-xr-x 870 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env entity
<object default-lang="python">
  <window name="main" ondelete="entity:exit">
  <button name="add" label="add" onclick="add_buttons"/>
  <button label="remove" onclick="remove_buttons"/>
  <valign name="main">
  </valign>
  <norender>
   <button name="$str" label="$label"/>
  </norender>

<python>
def add_buttons(node):
	print "PYTHON 1"
	loc = enode("valign.main")
	print "PYTHON 2"
	button = enode("button.$str")
	print "PYTHON 3"	
	xml = button.get_xml()
	print "PYTHON xml is:"
	print "***"
	print xml
	print "***"
	print "PYTHON 4"	
	loc.append_xml(xml)	
	print "PYTHON 5"
	button = enode("button.add")
	print "PYTHON 6"	
	button.attrib( {"label": "pressed"} )
	print "PYTHON 7"
	print button.attrib( "label" )
	print "PYTHON 8"	
def remove_buttons(node):
	loc = enode("valign.main")
	loc.destroy_children()
</python>

  </window>

</object>