The code that follows is the output of PAGE. The comments
beginning with '###' were added to emphasize certain features.
Note that the functions were defined using features of PAGE;
everything below came from PAGE.
#! /usr/bin/env python # Generated by PAGE v 0.8 from Tkinter import * import Tix, sys root = Tix.Tk() root.tk.call('load','','Tix') ### A bunch of functions in alphabetic order used within the GUI. ### Most are generated by the user. So far these are things ### like routines to load list boxes, update progress bars, ### and do stuff in response to mouse clicks, etc.. def greeting(str): import Dialog Dialog.Dialog(title="greetings", text=str, bitmap="",default=0,strings=("cont",)) def init(): pass def load_listbox(o): for i in range(50): o.insert(END, i) def load_scrolled_text(o): o.insert(END, "\n1. This is a long bit of text that I want to put inside" + " this text box.") o.insert(END, "\n2. This is a long bit of text that I want to put inside" + " this text box.") o.insert(END, "\n3. This is a long bit of text that I want to put inside" + " this text box.") o.insert(END, "\n4. This is a long bit of text that I want to put inside" + " this text box.") o.insert(END, "\n5. This is a long bit of text that I want to put inside" + " this text box.") o.insert(END, "\n6. This is a long bit of text that I want to put inside" + " this text box.") o.insert(END, "\n7. This is a long bit of text that I want to put inside" + " this text box.") o.insert(END, "\n8. This is a long bit of text that I want to put inside" + " this text box.") o.insert(END, "\n9. This is a long bit of text that I want to put inside" + " this text box.") o.insert(END, "\n0. This is a long bit of text that I want to put inside" + " this text box.") def load_tree(o): o.configure(separator="/") o.add("/",text="/") o.add("/home",text="home") o.add("/home/ioi",text="ioi") o.add("/home/foo",text="foo") o.add("/usr",text="usr") o.add("/usr/lib",text="lib") o.add("/home/rozen", text="rozen") o.add("/home/rozen/pkg", text="pkg") o.add("/home/rozen/pkg/PyTix", text="PyTix") o.add("/home/rozen/vp", text="vp") o.add("/home/rozen/vp/lib", text='lib') o.add("/usr/bin", text='bin') o.add("/usr/man", text='man') def open_file(): import tkFileDialog tkFileDialog.askopenfilename(filetypes=[("all files", "*")]) def quit(): root.destroy() def quit_a(event): print 'quit_a: ' + event.type quit() def run_demo(): import time for i in range(20): x = (5.0 * (i+1)) /100 print "str(x) =", str(x) w.tix34_tix31.configure(value=str(x)) w.tix34.update_idletasks() time.sleep(.3) def tree_browse(x): greeting(str(x)) ### The following class is the window. It is build by PAGE class New_Toplevel_1: def __init__(self, master=None): self.fra17 = Frame (master) self.fra17.place(in_=master,x=40,y=80) self.fra17.configure(relief=GROOVE) self.fra17.configure(background="green") self.fra17.configure(borderwidth="2") self.fra17.configure(height="75") self.fra17.configure(relief="groove") self.fra17.configure(width="125") self.fra17_but18 = Button (self.fra17) self.fra17_but18.place(in_=self.fra17,x=20,y=20) self.fra17_but18.configure(activebackground="black") self.fra17_but18.configure(activeforeground="ivory") self.fra17_but18.configure(background="red") self.fra17_but18.configure(command=quit) self.fra17_but18.configure(font="helvetica 14 bold") self.fra17_but18.configure(foreground="black") self.fra17_but18.configure(text="Quit") self.lab17 = Label (master) self.lab17.place(in_=master,x=25,y=40) self.lab17.configure(background="wheat") self.lab17.configure(borderwidth="1") self.lab17.configure(font="helvetica 14 bold") self.lab17.configure(foreground="black") self.lab17.configure(relief="raised") self.lab17.configure(text="Don's Demo") self.tex17 = Text (master) self.tex17.place(in_=master,x=200,y=50) self.tex17.configure(background="Wheat") self.tex17.configure(font="helvetica 14 bold") self.tex17.configure(foreground="black") self.tex17.configure(height="8") self.tex17.configure(insertbackground="black") self.tex17.configure(selectbackground="black") self.tex17.configure(selectforeground="ivory") self.tex17.configure(width="20") load_scrolled_text(self.tex17) # ldcmd self.ent17 = Entry (master) self.ent17.place(in_=master,x=50,y=200) self.ent17.configure(background="plum") self.ent17.configure(font="helvetica 14 bold") self.ent17.configure(foreground="black") self.ent17.configure(insertbackground="black") self.ent17.configure(selectbackground="black") self.ent17.configure(selectforeground="ivory") self.hello = StringVar() self.ent17.configure(textvariable=self.hello) self.ent17.configure(width="35") self.ent17.bind('q',lambda e: greeting('q')) self.fra19 = Frame (master) self.fra19.place(in_=master,x=200,y=240) self.fra19.configure(relief=GROOVE) self.fra19.configure(background="wheat") self.fra19.configure(borderwidth="4") self.fra19.configure(height="115") self.fra19.configure(relief="groove") self.fra19.configure(width="125") self.fra19_rad20 = Radiobutton (self.fra19) self.fra19_rad20.place(in_=self.fra19,x=5,y=40) self.fra19_rad20.configure(activebackground="black") self.fra19_rad20.configure(activeforeground="ivory") self.fra19_rad20.configure(background="wheat") self.fra19_rad20.configure(command=lambda : greeting("Radio 2 ")) self.fra19_rad20.configure(font="helvetica 14 bold") self.fra19_rad20.configure(foreground="black") self.fra19_rad20.configure(selectcolor="red") self.fra19_rad20.configure(text="radio 1") self.fra19_rad22 = Radiobutton (self.fra19) self.fra19_rad22.place(in_=self.fra19,x=5,y=75) self.fra19_rad22.configure(activebackground="black") self.fra19_rad22.configure(activeforeground="ivory") self.fra19_rad22.configure(background="wheat") self.fra19_rad22.configure(command=lambda : greeting("Radio 2 ")) self.fra19_rad22.configure(font="helvetica 14 bold") self.fra19_rad22.configure(foreground="black") self.fra19_rad22.configure(selectcolor="red") self.fra19_rad22.configure(text="radio 2") self.fra19_rad22.configure(value="2") self.fra19_lab19 = Label (self.fra19) self.fra19_lab19.place(in_=self.fra19,x=0,y=0) self.fra19_lab19.configure(background="wheat") self.fra19_lab19.configure(borderwidth="1") self.fra19_lab19.configure(font="helvetica 14 bold") self.fra19_lab19.configure(foreground="black") self.fra19_lab19.configure(text="Radio Buttons") self.fra18 = Frame (master) self.fra18.place(in_=master,x=30,y=245) self.fra18.configure(relief=GROOVE) self.fra18.configure(background="wheat") self.fra18.configure(borderwidth="4") self.fra18.configure(height="110") self.fra18.configure(relief="groove") self.fra18.configure(width="125") self.fra18_che20 = Checkbutton (self.fra18) self.fra18_che20.place(in_=self.fra18,x=5,y=40) self.fra18_che20.configure(activebackground="black") self.fra18_che20.configure(activeforeground="ivory") self.fra18_che20.configure(background="wheat") self.fra18_che20.configure(command=lambda :greeting("Check Button 1")) self.fra18_che20.configure(font="helvetica 14 bold") self.fra18_che20.configure(foreground="black") self.fra18_che20.configure(selectcolor="blue") self.fra18_che20.configure(text="check 1") self.fra18_che21 = Checkbutton (self.fra18) self.fra18_che21.place(in_=self.fra18,x=5,y=75) self.fra18_che21.configure(activebackground="black") self.fra18_che21.configure(activeforeground="ivory") self.fra18_che21.configure(background="wheat") self.fra18_che21.configure(command=lambda :greeting("Check Button 2")) self.fra18_che21.configure(font="helvetica 14 bold") self.fra18_che21.configure(foreground="black") self.fra18_che21.configure(selectcolor="blue") self.fra18_che21.configure(text="check 2") self.fra18_lab22 = Label (self.fra18) self.fra18_lab22.place(in_=self.fra18,x=5,y=5) self.fra18_lab22.configure(background="wheat") self.fra18_lab22.configure(borderwidth="1") self.fra18_lab22.configure(font="helvetica 14 bold") self.fra18_lab22.configure(foreground="black") self.fra18_lab22.configure(text="Check Buttons") self.lis17 = Listbox (master) self.lis17.place(in_=master,x=430,y=80) self.lis17.configure(background="wheat") self.lis17.configure(font="helvetica 14 bold") self.lis17.configure(foreground="black") self.lis17.configure(selectbackground="black") self.lis17.configure(selectforeground="ivory") load_listbox(self.lis17) # ldcmd self.lis17.bind('',self.list_handler) # bindcmd self.lis17.bind(' ',lambda e: quit_a(e)) self.sca17 = Scale (master) self.sca17.place(in_=master,x=540,y=315) self.sca17.configure(background="Wheat") self.sca17.configure(font="helvetica 18") self.sca17.configure(length="271") self.sca17.configure(orient="horizontal") self.sca17.configure(tickinterval="10.0") self.tootsie = DoubleVar() self.sca17.configure(variable=self.tootsie) self.tix28 = Tix.LabelFrame(master) self.tix28.place(in_=master,x=690,y=60) self.tix28.configure(label="Outside Frame") self.tix28.configure(background="red") self.tix28.configure(borderwidth="2") self.tix28.configure(highlightbackground="#d9d9d9") self.tix28.configure(highlightcolor="Black") tix28_frame = self.tix28.subwidget_list["frame"] tix28_frame.configure(background="blue") tix28_frame.configure(height="200") tix28_frame.configure(width="150") tix28_frame = self.tix28.subwidget_list["label"] tix28_frame.configure(background="green") tix28_frame.configure(font="helvetica 18") tix28_frame.configure(relief="sunken") tix28_frame.configure(text="Outside Frame") self.f = self.tix28.subwidget_list["frame"] self.tix28_tix29 = Tix.LabelFrame(self.f) self.tix28_tix29.place(in_=self.f,x=10,y=125) self.tix28_tix29.configure(label="Frame A") self.tix28_tix29.configure(background="wheat") self.tix28_tix29.configure(borderwidth="2") self.tix28_tix29.configure(highlightbackground="#d9d9d9") self.tix28_tix29.configure(highlightcolor="Black") tix28_tix29_frame = self.tix28_tix29.subwidget_list["frame"] tix28_tix29_frame.configure(background="wheat") tix28_tix29_frame.configure(height="30") tix28_tix29_frame.configure(width="30") tix28_tix29_frame = self.tix28_tix29.subwidget_list["label"] tix28_tix29_frame.configure(background="wheat") tix28_tix29_frame.configure(font="helvetica 18") tix28_tix29_frame.configure(text="Frame A") self.f = self.tix28.subwidget_list["frame"] self.tix28_tix30 = Tix.LabelFrame(self.f) self.tix28_tix30.place(in_=self.f,x=20,y=25) self.tix28_tix30.configure(label="Frame B") self.tix28_tix30.configure(background="wheat") self.tix28_tix30.configure(borderwidth="2") self.tix28_tix30.configure(highlightbackground="#d9d9d9") self.tix28_tix30.configure(highlightcolor="Black") tix28_tix30_frame = self.tix28_tix30.subwidget_list["frame"] tix28_tix30_frame.configure(background="wheat") tix28_tix30_frame.configure(height="44") tix28_tix30_frame.configure(width="105") tix28_tix30_frame = self.tix28_tix30.subwidget_list["label"] tix28_tix30_frame.configure(background="wheat") tix28_tix30_frame.configure(font="helvetica 18") tix28_tix30_frame.configure(text="Frame B") self.f = self.tix28_tix30.subwidget_list["frame"] self.tix28_but29 = Button (self.f) self.tix28_but29.place(in_=self.f,x=5,y=0) self.tix28_but29.configure(background="pink") self.tix28_but29.configure(command=quit) self.tix28_but29.configure(font="helvetica 18") self.tix28_but29.configure(text="exit") self.tix29 = Tix.ScrolledListBox(master) self.tix29.place(in_=master,x=410,y=440) self.tix29.configure(background="wheat") self.tix29.configure(highlightbackground="#d9d9d9") self.tix29.configure(highlightcolor="Black") self.tix29_listbox = self.tix29.subwidget_list["listbox"] self.tix29_listbox.configure(background="#08db24") self.tix29_listbox.configure(font="helvetica 18") self.list_x = self.tix29_listbox load_listbox(self.tix29_listbox) # ldcmd self.tix29_listbox.bind(' ',self.list_handler_2) # bindcmd self.lab30 = Label (master) self.lab30.place(in_=master,x=420,y=400) self.lab30.configure(background="wheat") self.lab30.configure(borderwidth="1") self.lab30.configure(font="helvetica 18") self.lab30.configure(relief="raised") self.lab30.configure(text="TixScrolledListBox") self.lab30.configure(width="17") self.tix31 = Tix.OptionMenu(master) self.tix31.place(in_=master,x=85,y=395) self.tix31.configure(label="OptionMenu: ") self.tix31.configure(background="wheat") self.tix31.configure(highlightbackground="#d9d9d9") self.tix31.configure(highlightcolor="Black") self.tix31.add_command("z_3",label="Option 1",underline=0) self.tix31.add_command("z_4",label="Option 2",underline=0) self.tix31.add_separator("z_5") self.tix30 = Tix.LabelEntry(master) self.tix30.place(in_=master,x=100,y=515) self.tix30.configure(disabledforeground="#a3a3a3") self.tix30.configure(label="LabelEntry:") self.tix30.configure(background="wheat") self.tix30.configure(highlightbackground="#d9d9d9") self.tix30.configure(highlightcolor="Black") self.tix30_entry = self.tix30.subwidget_list["entry"] self.tix30_entry.configure(background="wheat") self.tix30_entry.configure(font="helvetica 18") self.vu_file = StringVar() self.tix30_entry.configure(textvariable=self.vu_file) self.tix30_entry.configure(width="5") self.tix30_label = self.tix30.subwidget_list["label"] self.tix30_label.configure(background="wheat") self.tix30_label.configure(font="Helvetica -18 bold") self.tix30_label.configure(text="LabelEntry:") self.tix32 = Tix.ComboBox(master,dropdown=1,editable=0,fancy=0) self.tix32.place(in_=master,x=60,y=455) self.tix32.configure(arrowbitmap="@/home/rgelpc254/rozen/lib/tix8.1/bitmaps/cbxarrow.xbm") self.tix32.configure(crossbitmap="@/home/rgelpc254/rozen/lib/tix8.1/bitmaps/cross.xbm") self.tix32.configure(disabledforeground="#a3a3a3") self.tix32.configure(history="0") self.tix32.configure(prunehistory="1") self.tix32.configure(tickbitmap="@/home/rgelpc254/rozen/lib/tix8.1/bitmaps/tick.xbm") self.tix32.configure(background="wheat") self.tix32.configure(highlightbackground="#d9d9d9") self.tix32.configure(highlightcolor="Black") load_listbox(self.tix32) # ldcmd self.tix33 = Tix.Tree(master,options='\ hlist.background "pink"\ hlist.borderWidth "0"\ hlist.drawBranch "1"\ hlist.font "Helvetica -18 bold"\ hlist.highlightThickness "0"\ hlist.selectBackground "#c3c3c3"\ hlist.wideSelection "1"') self.tix33.place(in_=master,x=670,y=400) self.tix33.configure(browsecmd=lambda entry=None: tree_browse(entry)) self.tix33.configure(ignoreinvoke="0") self.tix33.configure(scrollbar="auto") self.tix33.configure(background="wheat") self.tix33.configure(borderwidth="1") self.tix33.configure(height="167") self.tix33.configure(width="212") self.T1 = self.tix33.subwidget_list['hlist'] load_tree(self.T1) # ldcmd self.tix33.autosetmode() self.tix34 = Tix.NoteBook(master) self.tix34.place(in_=master,x=40,y=550) self.tix34.configure(background="wheat") self.tix34.configure(height="213") self.tix34.configure(highlightbackground="#d9d9d9") self.tix34.configure(highlightcolor="Black") self.tix34.configure(width="335") self.nbf = self.tix34.subwidget_list["nbframe"] self.nbf.configure(background="wheat") self.nbf.configure(font="helvetica 18") self.nbf.configure(inactivebackground="ivory") self.nbf.configure(relief="raised") self.nbf.configure(tabpadx="8") self.tix34.add("page1",anchor="center",label="Page 1") self.tix34.add("page2",anchor="center",label="Page 2") self.tix34.add("page3",anchor="center",label="Page 3") self.tix34.add("page4",anchor="center",label="Page 4") self.page1 = self.tix34.subwidget_list["page1"] self.tix34_but36 = Button (self.page1) self.tix34_but36.place(in_=self.page1,x=20,y=65) self.tix34_but36.configure(background="red") self.tix34_but36.configure(command=quit) self.tix34_but36.configure(font="helvetica 18") self.tix34_but36.configure(text="So Long") self.page2 = self.tix34.subwidget_list["page2"] self.tix34_but38 = Button (self.page2) self.tix34_but38.place(in_=self.page2,x=230,y=65) self.tix34_but38.configure(background="green") self.tix34_but38.configure(command=quit) self.tix34_but38.configure(font="helvetica 18") self.tix34_but38.configure(text="Good By") self.page3 = self.tix34.subwidget_list["page3"] self.tix34_but39 = Button (self.page3) self.tix34_but39.place(in_=self.page3,x=210,y=120) self.tix34_but39.configure(activeforeground="black") self.tix34_but39.configure(background="Blue") self.tix34_but39.configure(command=quit) self.tix34_but39.configure(font="helvetica 18") self.tix34_but39.configure(foreground="white") self.tix34_but39.configure(text="Go Away") self.page4 = self.tix34.subwidget_list["page4"] self.tix34_tix30 = Tix.LabelFrame(self.page4) self.tix34_tix30.place(in_=self.page4,x=5,y=5) self.tix34_tix30.configure(label="label-me") self.tix34_tix30.configure(background="wheat") self.tix34_tix30.configure(borderwidth="2") self.tix34_tix30.configure(highlightbackground="#d9d9d9") self.tix34_tix30.configure(highlightcolor="Black") tix34_tix30_frame = self.tix34_tix30.subwidget_list["frame"] tix34_tix30_frame.configure(background="wheat") tix34_tix30_frame.configure(height="108") tix34_tix30_frame.configure(width="309") tix34_tix30_frame = self.tix34_tix30.subwidget_list["label"] tix34_tix30_frame.configure(background="wheat") tix34_tix30_frame.configure(font="helvetica 18") tix34_tix30_frame.configure(text="Progress Bar") self.f = self.tix34_tix30.subwidget_list["frame"] self.tix34_tix31 = Tix.Meter(self.f) self.tix34_tix31.place(in_=self.f,x=130,y=40) self.tix34_tix31.configure(foreground="Black") self.tix34_tix31.configure(value=".3") self.tix34_tix31.configure(background="wheat") self.tix34_tix31.configure(borderwidth="2") self.tix34_tix31.configure(highlightbackground="#d9d9d9") self.tix34_tix31.configure(highlightcolor="Black") self.tix34_tix31.configure(relief="sunken") self.tix34_tix31.configure(width="150") self.f = self.tix34_tix30.subwidget_list["frame"] self.tix34_but32 = Button (self.f) self.tix34_but32.place(in_=self.f,x=10,y=30) self.tix34_but32.configure(background="wheat") self.tix34_but32.configure(command=lambda : run_demo()) self.tix34_but32.configure(font="helvetica 18") self.tix34_but32.configure(text="Demo") self.tix35 = Tix.ScrolledText(master) self.tix35.place(in_=master,x=660,y=630) self.tix35.configure(background="wheat") self.tix35.configure(borderwidth="1") self.tix35.configure(height="141") self.tix35.configure(highlightbackground="#d9d9d9") self.tix35.configure(highlightcolor="Black") self.tix35.configure(width="254") self.tix35_text = self.tix35.subwidget_list["text"] load_scrolled_text(self.tix35_text) # ldcmd self.tix35_text.configure(background="wheat") self.tix35_text.configure(font="helvetica 18") self.tix35_text.configure(takefocus="1") self.tix35_text.configure(wrap="none") self.tix36 = Tix.Meter(master) self.tix36.place(in_=master,x=685,y=580) self.tix36.configure(foreground="Black") self.tix36.configure(value=".3") self.tix36.configure(background="wheat") self.tix36.configure(borderwidth="2") self.tix36.configure(highlightbackground="#d9d9d9") self.tix36.configure(highlightcolor="Black") self.tix36.configure(relief="sunken") self.tix36.configure(width="150") self.menubar = Frame(master,relief=RAISED, bd=2) self.menubar.pack(side=TOP,fill=X) self.men18 = Menubutton(self.menubar, underline = 0) self.men18.pack(side=LEFT) self.men18.configure(text="File") self.men18_1 = Menu(self.men18) self.men18_1.add_command(label="Open",command=open_file,underline=0) self.men18_1.add_command(label="Close",command=lambda :greeting("close"),underline=0) self.men18_1.add_command(label="Exit",command=quit,underline=0) self.men18['menu'] = self.men18_1 self.men17 = Menubutton(self.menubar, underline = 0) self.men17.pack(side=LEFT) self.men17.configure(text="Edit") self.men17_2 = Menu(self.men17) self.men17_2.add_command(label="Cut",command=lambda:greeting("Cut"),underline=0) self.men17_2.add_command(label="Paste",command=lambda :greeting("Paste"),underline=0) self.men17_2.add_command(label="Copy",command=lambda : greeting("Copy"),underline=0) self.men17_3 = Menu(self.men17_2) self.men17_2.add_cascade(label="Advanced",menu=self.men17_3) self.men17_3.add_command(label="ToUpper",command=lambda :greeting("ToUpper"),underline=0) self.men17_3.add_command(label="ToLower",command=lambda : greeting("ToLower"),underline=0) self.men17_2.add_command(label="Delete",command=lambda : greeting("Delete"),underline=0) self.men17['menu'] = self.men17_2 self.men28 = Menubutton(self.menubar, underline = 0) self.men28.pack(side=LEFT) self.men28.configure(text="Font") self.men28_3 = Menu(self.men28) self.men28_3.add_checkbutton(label="Courier",command=lambda : greeting("Courier")) self.men28_3.add_checkbutton(label="Times Roman",command=lambda : greeting("Times Roman")) self.men28_3.add_checkbutton(label="Bodini Book",command=lambda : greeting("Bodini Book")) self.men28['menu'] = self.men28_3 self.men29 = Menubutton(self.menubar, underline = 0) self.men29.pack(side=LEFT) self.men29.configure(text="IDE") self.men29_4 = Menu(self.men29) self.men29_4.add_radiobutton(label="Emacs",command=lambda : greeting("Emacs")) self.men29_4.add_radiobutton(label="IDLE",command=lambda : greeting("IDLE")) self.men29['menu'] = self.men29_4 self.men23 = Menubutton(self.menubar, underline = 0) self.men23.pack(side=RIGHT) self.men23.configure(text="Help") self.men23_5 = Menu(self.men23) self.men23['menu'] = self.men23_5 self.balloon = Tix.Balloon(master) self.balloon.bind_widget(self.tix29_listbox,balloonmsg="An example of balloon help message.") self.balloon.bind_widget(self.men29,balloonmsg="Select the environemt that you wish to use.") self.balloon.configure(bg='blue', borderwidth=3) ### The following are user generated methods used in the GUI ### There is no difference between these and the global methods ### other than the user specified them by naming them specially. ### That is, the name specified in PAGE had 'self.' prepended. def list_handler(self, x): index = self.tix29_listbox.curselection() greeting(index) def list_handler_2(self, x): index = self.list_x.curselection() greeting(index) ### A generated function for starting the GUI. ### If you have stuff to add put it in init. def vp_start_gui(): global w root.title('New_Toplevel_1') root.geometry('934x797+82+219') w = New_Toplevel_1 (root) init() root.mainloop() ### The following is so that you can run the GUI stand alone and see ### what it looks like. if __name__ == '__main__': vp_start_gui()