1 #!/usr/local/bin/python
5 # Tix Demostration Program
7 # This sample program is structured in such a way so that it can be
8 # executed from the Tix demo program "tixwidgets": it must have a
9 # procedure called "RunSample". It should also have the "if" statment
10 # at the end of this file so that it can be run as a standalone
13 # This file demonstrates the use of the tixBalloon widget, which provides
14 # a interesting way to give help tips about elements in your user interface.
15 # Your can display the help message in a "balloon" and a status bar widget.
21 status
= Tix
.Label(w
, width
=40, relief
=Tix
.SUNKEN
, bd
=1)
22 status
.pack(side
=Tix
.BOTTOM
, fill
=Tix
.Y
, padx
=2, pady
=1)
24 # Create two mysterious widgets that need balloon help
25 button1
= Tix
.Button(w
, text
='Something Unexpected',
26 command
=lambda w
=w
: w
.destroy())
27 button2
= Tix
.Button(w
, text
='Something Else Unexpected')
28 button2
['command'] = lambda w
=button2
: w
.destroy()
29 button1
.pack(side
=Tix
.TOP
, expand
=1)
30 button2
.pack(side
=Tix
.TOP
, expand
=1)
32 # Create the balloon widget and associate it with the widgets that we want
33 # to provide tips for:
34 b
= Tix
.Balloon(w
, statusbar
=status
)
36 b
.bind_widget(button1
, balloonmsg
='Close Window',
37 statusmsg
='Press this button to close this window')
38 b
.bind_widget(button2
, balloonmsg
='Self-destruct button',
39 statusmsg
='Press this button and it will destroy itself')
41 if __name__
== '__main__':