PageRenderTime 82ms CodeModel.GetById 30ms app.highlight 32ms RepoModel.GetById 19ms app.codeStats 0ms

/examples/kitchensink/Buttons.py

http://pyjamas.googlecode.com/
Python | 49 lines | 40 code | 9 blank | 0 comment | 0 complexity | 148461dc06bb765cdbbc99d05fe1f9f5 MD5 | raw file
 1from Sink import Sink, SinkInfo
 2from ui import Button, CheckBox, VerticalPanel, HorizontalPanel, RadioButton
 3
 4class Buttons(Sink):
 5    def __init__(self):
 6        disabledButton = Button("Disabled Button")
 7        disabledCheck = CheckBox("Disabled Check")
 8        normalButton = Button("Normal Button")
 9        normalCheck = CheckBox("Normal Check")
10        panel = VerticalPanel()
11        radio0 = RadioButton("group0", "Choice 0")
12        radio1 = RadioButton("group0", "Choice 1")
13        radio2 = RadioButton("group0", "Choice 2 (Disabled)")
14        radio3 = RadioButton("group0", "Choice 3")
15
16        hp=HorizontalPanel()
17        panel.add(hp)
18        hp.setSpacing(8)
19        hp.add(normalButton)
20        hp.add(disabledButton)
21        
22        hp=HorizontalPanel()
23        panel.add(hp)
24        hp.setSpacing(8)
25        hp.add(normalCheck)
26        hp.add(disabledCheck)
27        
28        hp=HorizontalPanel()
29        panel.add(hp)
30        hp.setSpacing(8)
31        hp.add(radio0)
32        hp.add(radio1)
33        hp.add(radio2)
34        hp.add(radio3)
35        
36        disabledButton.setEnabled(False)
37        disabledCheck.setEnabled(False)
38        radio2.setEnabled(False)
39        
40        panel.setSpacing(8)
41        self.initWidget(panel)
42
43    def onShow(self):
44        pass
45
46
47def init():
48    text="GWT supports all the myriad types of buttons that exist in HTML.  Here are a few for your viewing pleasure."
49    return SinkInfo("Buttons", text, Buttons)