blob: 03c3234cb09081ecaa054d4f7891945f4c24f6ef (
plain)
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
41
42
43
44
45
46
47
48
49
|
#!/usr/bin/env python
from waxy import *
class MainFrame(Frame): # frame has a sizer built in
def Body(self):
self.CenterOnScreen()
self.CreateStatusBar()
self.SetStatusText("This is the statusbar")
menubar = MenuBar(self)
menu1 = Menu(self)
menu1.Append("E&xit", self.CloseWindow, "Exit demo",hotkey="Ctrl+Q")
menubar.Append(menu1, "&File")
b = Button(self, "Color Dialog",self.Color,default=True)
self.AddComponent(b)
self.Pack()
self.SetSize((640, 480))
def Color(self,event):
dlg=ColorDialog(self)
res=dlg.ShowModal()
if res=='ok':
print "Ok: ",dlg.GetChosenColor()
else:
print "Canceled!"
dlg.Destroy()
def CloseWindow(self,event):
self.Close()
if __name__=="__main__":
app = Application(MainFrame, title="ColorDialog")
app.Run()
|