9 def __init__(self
, master
=None, cnf
={}):
10 Button
.__init
__(self
, master
,
13 'command': self
.quit
},
19 self
.itemconfig('current', {'fill': 'red'})
22 self
.itemconfig('current', {'fill': 'blue'})
23 def __init__(self
, master
=None, cnf
={}):
24 Canvas
.__init
__(self
, master
,
25 {'width': 100, 'height': 100})
26 Canvas
.config(self
, cnf
)
27 self
.create_rectangle(30, 30, 70, 70,
28 {'fill': 'blue', 'tags': 'box'})
29 Canvas
.bind(self
, 'box', '<Enter>', self
.enter
)
30 Canvas
.bind(self
, 'box', '<Leave>', self
.leave
)
39 self
.text
= 'Testing 1 ...'
40 self
.text
= self
.text
+ ' ' + `self
.num`
41 self
.num
= self
.num
+ 1
42 self
.testing
['text'] = self
.text
47 self
.after(10000, self
.do_after
)
48 def __init__(self
, master
=None):
49 Frame
.__init
__(self
, master
)
52 self
.bind('<Motion>', self
.do_xy
)
53 self
.hello
= Button(self
, {'name': 'hello',
56 Pack
: {'fill': 'both'}})
57 self
.testing
= Button(self
)
58 self
.testing
['text'] = self
.text
59 self
.testing
['command'] = self
.do_test
60 Pack
.config(self
.testing
, {'fill': 'both'})
61 self
.err
= Button(self
, {'text': 'Error',
62 'command': self
.do_err
,
63 Pack
: {'fill': 'both'}})
64 self
.quit
= Quit(self
, {Pack
: {'fill': 'both'}})
65 self
.exit
= Button(self
,
67 'command': lambda: sys
.exit(0),
68 Pack
: {'fill': 'both'}})
69 self
.stuff
= Stuff(self
, {Pack
: {'padx': 2, 'pady': 2}})
73 test
.master
.title('Tkinter Test')
74 test
.master
.iconname('Test')
75 test
.master
.maxsize(500, 500)
78 # Use the -i option and type ^C to get a prompt