~malept/ubuntu/lucid/python2.6/dev-dependency-fix

« back to all changes in this revision

Viewing changes to Demo/tix/samples/BtnBox.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2009-02-13 12:51:00 UTC
  • Revision ID: james.westby@ubuntu.com-20090213125100-uufgcb9yeqzujpqw
Tags: upstream-2.6.1
ImportĀ upstreamĀ versionĀ 2.6.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
 
2
#
 
3
# $Id: BtnBox.py 36560 2004-07-18 06:16:08Z tim_one $
 
4
#
 
5
# Tix Demostration Program
 
6
#
 
7
# This sample program is structured in such a way so that it can be
 
8
# executed from the Tix demo program "tixwidgets.py": 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
 
11
# program.
 
12
 
 
13
# This file demonstrates the use of the tixButtonBox widget, which is a
 
14
# group of TK buttons. You can use it to manage the buttons in a dialog box,
 
15
# for example.
 
16
#
 
17
 
 
18
import Tix
 
19
 
 
20
def RunSample(w):
 
21
    # Create the label on the top of the dialog box
 
22
    #
 
23
    top = Tix.Label(w, padx=20, pady=10, bd=1, relief=Tix.RAISED,
 
24
                    anchor=Tix.CENTER, text='This dialog box is\n a demonstration of the\n tixButtonBox widget')
 
25
 
 
26
    # Create the button box and add a few buttons in it. Set the
 
27
    # -width of all the buttons to the same value so that they
 
28
    # appear in the same size.
 
29
    #
 
30
    # Note that the -text, -underline, -command and -width options are all
 
31
    # standard options of the button widgets.
 
32
    #
 
33
    box = Tix.ButtonBox(w, orientation=Tix.HORIZONTAL)
 
34
    box.add('ok', text='OK', underline=0, width=5,
 
35
            command=lambda w=w: w.destroy())
 
36
    box.add('close', text='Cancel', underline=0, width=5,
 
37
            command=lambda w=w: w.destroy())
 
38
    box.pack(side=Tix.BOTTOM, fill=Tix.X)
 
39
    top.pack(side=Tix.TOP, fill=Tix.BOTH, expand=1)
 
40
 
 
41
if __name__ == '__main__':
 
42
    root = Tix.Tk()
 
43
    RunSample(root)
 
44
    root.mainloop()