Download presentation
Presentation is loading. Please wait.
Published byJustine English Modified over 10 years ago
1
Tk
2
Toolkit n Wish - windowing shell –touch fileName –chmod +x fileName –xedit fileName & –#!/usr/local/bin/wish n Widgets - eg Buttons, Labels, Frames n Geometry - Placer and Packer n Bindings - Events n Wumpus Interface
3
Widgets n Example of widgets : –Frame –Label –Button –Checkbutton –Radiobutton –Menubutton –Menu –Entry –Text –Canvas –Scrollbar –Scale –Listbox –Toplevel
4
Creating widgets Example a button : button.button -text “Hello world” -foreground red -command { destroy. } pack.button -padx 1.0c -pady 1.0c
5
Bindings n Attached to an Event –ButtonPress –ButtonRelease –Enter –KeyPress –KeyRelease –Motion –Leave bind.button {.button configure - activeforeground green } bind.button {.button configure - background blue }
6
Geometry n Geometry managers control widget placements n Widgets appear only when told to by the geometry manager n Algorithm for arranging positions n Placer –Simple –Allows programmer to say exactly where objects appear n Packer –Side –Padding –Filling –Expansion
7
The Wumpus World.frame4.label.frame4.agenttype.frame5.label.frame5.seed.frame.set.frame2.frame.step.frame3.frame.run.a.frame.quit.frame.pic canvas.a.frame2.label.frame2.value.frame3.label.frame3.execute
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.