mirror of
https://github.com/python/cpython.git
synced 2025-10-28 20:25:04 +00:00
Patch #485959: Various changes to Tix demos.
This commit is contained in:
parent
42ab61eeab
commit
8ec03e0528
14 changed files with 407 additions and 308 deletions
|
|
@ -5,7 +5,7 @@
|
|||
# Tix Demostration Program
|
||||
#
|
||||
# This sample program is structured in such a way so that it can be
|
||||
# executed from the Tix demo program "widget": it must have a
|
||||
# executed from the Tix demo program "tixwidgets.py": it must have a
|
||||
# procedure called "RunSample". It should also have the "if" statment
|
||||
# at the end of this file so that it can be run as a standalone
|
||||
# program using tixwish.
|
||||
|
|
@ -19,16 +19,21 @@
|
|||
import Tix, os, copy
|
||||
from Tkconstants import *
|
||||
|
||||
def RunSample (w):
|
||||
DemoDirTree(w)
|
||||
TCL_ALL_EVENTS = 0
|
||||
|
||||
def RunSample (root):
|
||||
dirtree = DemoDirTree(root)
|
||||
dirtree.mainloop()
|
||||
dirtree.destroy()
|
||||
|
||||
class DemoDirTree:
|
||||
def __init__(self, w):
|
||||
self.root = w
|
||||
self.exit = -1
|
||||
|
||||
z = w.winfo_toplevel()
|
||||
z.wm_title('Tix.DirTree Widget Demo')
|
||||
|
||||
z.wm_protocol("WM_DELETE_WINDOW", lambda self=self: self.quitcmd())
|
||||
|
||||
# Create the tixDirTree and the tixLabelEntry widgets on the on the top
|
||||
# of the dialog box
|
||||
|
||||
|
|
@ -90,19 +95,24 @@ def copy_name (self, dir, ent):
|
|||
ent.entry.insert(0, self.dlist_dir)
|
||||
|
||||
def okcmd (self):
|
||||
# tixDemo:Status "You have selected the directory" + $self.dlist_dir
|
||||
|
||||
# tixDemo:Status "You have selected the directory" + self.dlist_dir
|
||||
self.quitcmd()
|
||||
|
||||
def quitcmd (self):
|
||||
# tixDemo:Status "You have selected the directory" + self.dlist_dir
|
||||
self.exit = 0
|
||||
|
||||
def mainloop(self):
|
||||
while self.exit < 0:
|
||||
self.root.tk.dooneevent(TCL_ALL_EVENTS)
|
||||
|
||||
def destroy (self):
|
||||
self.root.destroy()
|
||||
|
||||
# This "if" statement makes it possible to run this script file inside or
|
||||
# outside of the main demo program "widget".
|
||||
# outside of the main demo program "tixwidgets.py".
|
||||
#
|
||||
if __name__== '__main__' :
|
||||
root=Tix.Tk()
|
||||
RunSample(root)
|
||||
root.mainloop()
|
||||
root.destroy()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue