~ubuntu-branches/ubuntu/karmic/python3.0/karmic

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2009-02-16 17:18:23 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20090216171823-1d5cm5qnnjvmnzzm
Tags: 3.0.1-0ubuntu1
New upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
2
2
#
3
 
# $Id: SHList1.py 36560 2004-07-18 06:16:08Z tim_one $
 
3
# $Id: SHList1.py 68310 2009-01-04 19:01:19Z benjamin.peterson $
4
4
#
5
5
# Tix Demostration Program
6
6
#
13
13
# This file demonstrates the use of the tixScrolledHList widget.
14
14
#
15
15
 
16
 
import Tix
 
16
import tkinter.tix
17
17
 
18
18
TCL_ALL_EVENTS          = 0
19
19
 
33
33
        # We create the frame and the ScrolledHList widget
34
34
        # at the top of the dialog box
35
35
        #
36
 
        top = Tix.Frame( w, relief=Tix.RAISED, bd=1)
 
36
        top = tkinter.tix.Frame( w, relief=tkinter.tix.RAISED, bd=1)
37
37
 
38
38
        # Put a simple hierachy into the HList (two levels). Use colors and
39
39
        # separator widgets (frames) to make the list look fancy
40
40
        #
41
 
        top.a = Tix.ScrolledHList(top)
42
 
        top.a.pack( expand=1, fill=Tix.BOTH, padx=10, pady=10, side=Tix.TOP)
 
41
        top.a = tkinter.tix.ScrolledHList(top)
 
42
        top.a.pack( expand=1, fill=tkinter.tix.BOTH, padx=10, pady=10, side=tkinter.tix.TOP)
43
43
 
44
44
        # This is our little relational database
45
45
        #
68
68
        count=0
69
69
        for boss,name in bosses :
70
70
            if count :
71
 
                f=Tix.Frame(hlist, name='sep%d' % count, height=2, width=150,
72
 
                    bd=2, relief=Tix.SUNKEN )
73
 
 
74
 
                hlist.add_child( itemtype=Tix.WINDOW,
75
 
                    window=f, state=Tix.DISABLED )
76
 
 
77
 
            hlist.add(boss, itemtype=Tix.TEXT, text=name)
 
71
                f=tkinter.tix.Frame(hlist, name='sep%d' % count, height=2, width=150,
 
72
                    bd=2, relief=tkinter.tix.SUNKEN )
 
73
 
 
74
                hlist.add_child( itemtype=tkinter.tix.WINDOW,
 
75
                    window=f, state=tkinter.tix.DISABLED )
 
76
 
 
77
            hlist.add(boss, itemtype=tkinter.tix.TEXT, text=name)
78
78
            count = count+1
79
79
 
80
80
 
99
99
 
100
100
        # Use a ButtonBox to hold the buttons.
101
101
        #
102
 
        box= Tix.ButtonBox(top, orientation=Tix.HORIZONTAL )
 
102
        box= tkinter.tix.ButtonBox(top, orientation=tkinter.tix.HORIZONTAL )
103
103
        box.add( 'ok',  text='Ok', underline=0,  width=6,
104
104
            command = self.okcmd)
105
105
 
106
106
        box.add( 'cancel', text='Cancel', underline=0, width=6,
107
107
            command = self.quitcmd)
108
108
 
109
 
        box.pack( side=Tix.BOTTOM, fill=Tix.X)
110
 
        top.pack( side=Tix.TOP,    fill=Tix.BOTH, expand=1 )
 
109
        box.pack( side=tkinter.tix.BOTTOM, fill=tkinter.tix.X)
 
110
        top.pack( side=tkinter.tix.TOP,    fill=tkinter.tix.BOTH, expand=1 )
111
111
 
112
112
    def okcmd (self):
113
113
        self.quitcmd()
127
127
# outside of the main demo program "tixwidgets.py".
128
128
#
129
129
if __name__== '__main__' :
130
 
    root=Tix.Tk()
 
130
    root=tkinter.tix.Tk()
131
131
    RunSample(root)