demoButton(name='PyView',
what='Image slideshow, plus note editor',
doit='Gui/SlideShow/slideShowPlus.py Gui/gifs',
code=['Gui/Texteditor/textEditor.py',
'Gui/SlideShow/slideShow.py',
'Gui/SlideShow/slideShowPlus.py'])
...code omitted: see examples package...
################################################################################
toggle info message box font once a second
################################################################################
def refreshMe(info, ncall):
slant = ['normal', 'italic', 'bold', 'bold italic'][ncall % 4]
info.config(font=('courier', 20, slant))
Root.after(1000, (lambda: refreshMe(info, ncall+1)) )
################################################################################
unhide/hide status box on info clicks
################################################################################
Stat.iconify()
def onInfo():
if Stat.state() == 'iconic':
Stat.deiconify()
else:
Stat.iconify() # was 'normal'
################################################################################
finish building main GUI, start event loop
################################################################################
def onLinks():
...code omitted: see examples package...
Button(Root, text='Info', command=onInfo).pack(side=TOP, fill=X)
Button(Root, text='Links', command=onLinks).pack(side=TOP, fill=X)
Button(Root, text='Quit', command=Root.quit).pack(side=BOTTOM, fill=X)
refreshMe(Info, 0) # start toggling
Root.mainloop()
PyGadgets Launcher Bar
The PyGadgets script runs some of the same programs as PyDemos, but for real, prac-
tical use, not as demonstrations. Both scripts use launchmodes to spawn other programs,
and display bars of launcher buttons, but PyGadgets is a bit simpler because its task is
more focused. PyGadgets also supports two spawning modes—it can either start a
canned list of programs immediately and all at once, or display a GUI for running each
program on demand. Figure 10-19 shows the launch bar GUI made in on-demand mode
when it first starts; PyDemos and PyGadgets can be run at the same time, and both
grow with their window if resized (try it on your own to see how).
The PyDemos and PyGadgets Launchers | 667