Skip to content
Newer
Older
100644 45 lines (33 sloc) 1.28 KB
851f2fc add toggle example
lkcl authored Apr 26, 2009
1 """ testint our demo slider
2 """
3
4 from pyjamas.ui.Label import Label
5 from pyjamas.ui.Button import Button
6 from pyjamas.ui.ButtonBase import ButtonBase
7 from pyjamas.ui.RootPanel import RootPanel
8 from pyjamas.ui.CustomButton import CustomButtom
9 from pyjamas.ui.ToggleButton import ToggleButton
631dce5 debian packaging
lkcl authored Apr 30, 2009
10 from pyjamas.ui.PushButton import PushButton
851f2fc add toggle example
lkcl authored Apr 26, 2009
11 from pyjamas import DOM
12
13
14 class Toggle:
15 def onModuleLoad(self):
16
17 self.label = Label("Not set yet")
18
19 self.button = Button("Probe button", self)
20 self.toggle = ToggleButton("up","down")
21 RootPanel().add(self.label)
22 RootPanel().add(self.button)
23 RootPanel().add(self.toggle)
24 self.i = 0
25
26 def onClick(self, sender):
27 if sender == self.button:
28 if self.i:
29 self.i = 0
30 self.toggle.setCurrentFace(self.toggle.getUpFace())
31 else:
32 self.i = 1
33 self.toggle.setCurrentFace(self.toggle.getDownFace())
34 self.label.setText("self.toggle.style_name: "+
35 self.toggle.style_name+", self.toggle.getStyleName():"+
36 self.toggle.getStyleName()+" ")
37
38
39 if __name__ == "__main__":
40 app = Toggle()
41 app.onModuleLoad()
42
43
44
Something went wrong with that request. Please try again.