File: OnClickTest.py

package info (click to toggle)
pyjamas 0.7~%2Bpre2-3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 10,656 kB
  • ctags: 12,331
  • sloc: python: 74,493; php: 805; sh: 291; makefile: 59; xml: 9
file content (31 lines) | stat: -rw-r--r-- 620 bytes parent folder | download
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
import pyjd # dummy in pyjs

from pyjamas.ui.Button import Button
from pyjamas.ui.RootPanel import RootPanel
from pyjamas import Window


def onButtonClick(sender):
	Window.alert("function called")


class OnClickTest:
	def onModuleLoad(self):
		self.b = Button("function callback", onButtonClick)
		self.b2 = Button("object callback", self)
		RootPanel().add(self.b)
		RootPanel().add(self.b2)

	def onClick(self, sender):
		Window.alert("object called")






if __name__ == '__main__':
    pyjd.setup("./OnClickTest.html") # dummy in pyjs
    app = OnClickTest()
    app.onModuleLoad()
    pyjd.run() # dummy in pyjs