コード例 #1
0
def MkDirListWidget(w):
    msg = Tix.Message(w, font='-*-helvetica-bold-r-normal-*-14-*-*-*-*-*-*-*',
		      relief=Tix.FLAT, width=240, anchor=Tix.N,
		      text='The TixDirList widget gives a graphical representation of the file system directory and makes it easy for the user to choose and access directories.')
    dirlist = Tix.DirList(w, options='hlist.padY 1 hlist.width 25 hlist.height 16')
    msg.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=3, pady=3)
    dirlist.pack(side=Tix.TOP, padx=3, pady=3)
コード例 #2
0
#-----------------------------------------------------------------------------
# Copyright (c) 2013, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------


import Tix as tix

root = tix.Tk()
root.title("Test for TiX")

tix.Label(text="Press <ESC> to exit").pack()
tix.DirList(root).pack()
tix.Button(root, text="Close", command=root.destroy).pack()
root.bind("<Escape>", lambda x: root.destroy())

tix.mainloop()
コード例 #3
0
    def __init__(self, w):
        self.root = w
        self.exit = -1

        z = w.winfo_toplevel()
        z.wm_protocol("WM_DELETE_WINDOW", lambda self=self: self.quitcmd())

        # Create the tixDirList and the tixLabelEntry widgets on the on the top
        # of the dialog box

        # bg = root.tk.eval('tix option get bg')
        # adding bg=bg crashes Windows pythonw tk8.3.3 Python 2.1.0

        top = Tix.Frame(w, relief=RAISED, bd=1)

        # Create the DirList widget. By default it will show the current
        # directory
        #
        #
        top.dir = Tix.DirList(top)
        top.dir.hlist['width'] = 40

        # When the user presses the ".." button, the selected directory
        # is "transferred" into the entry widget
        #
        top.btn = Tix.Button(top, text="  >>  ", pady=0)

        # We use a LabelEntry to hold the installation directory. The user
        # can choose from the DirList widget, or he can type in the directory
        # manually
        #
        top.ent = Tix.LabelEntry(top,
                                 label="Installation Directory:",
                                 labelside='top',
                                 options='''
                                  entry.width 40
                                  label.anchor w
                                  ''')

        font = self.root.tk.eval('tix option get fixed_font')
        # font = self.root.master.tix_option_get('fixed_font')
        top.ent.entry['font'] = font

        self.dlist_dir = copy.copy(os.curdir)
        # This should work setting the entry's textvariable
        top.ent.entry['textvariable'] = self.dlist_dir
        top.btn['command'] = lambda dir=top.dir, ent=top.ent, self=self: \
                             self.copy_name(dir,ent)

        # top.ent.entry.insert(0,'tix'+repr(self))
        top.ent.entry.bind('<Return>', lambda self=self: self.okcmd())

        top.pack(expand='yes', fill='both', side=TOP)
        top.dir.pack(expand=1, fill=BOTH, padx=4, pady=4, side=LEFT)
        top.btn.pack(anchor='s', padx=4, pady=4, side=LEFT)
        top.ent.pack(expand=1, fill=X, anchor='s', padx=4, pady=4, side=LEFT)

        # Use a ButtonBox to hold the buttons.
        #
        box = Tix.ButtonBox(w, orientation='horizontal')
        box.add('ok',
                text='Ok',
                underline=0,
                width=6,
                command=lambda self=self: self.okcmd())
        box.add('cancel',
                text='Cancel',
                underline=0,
                width=6,
                command=lambda self=self: self.quitcmd())

        box.pack(anchor='s', fill='x', side=BOTTOM)
コード例 #4
0
# -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
コード例 #5
0
# -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-