Beispiel #1
0
    def __create_widgets(self):
        _soptions = ("label.width 20 label.anchor w label.relief flat "
                     "menubutton.width 15 menubutton.relief groove ")
        _eoptions = ("entry.width 20 entry.relief groove "
                     "label.width 20 label.anchor w label.padx 0 ")

        _frame = Tix.Frame(self, borderwidth=2)
        _frame.grid(padx=2, pady=2, ipady=2, sticky="nesw")

        _w = Tix.OptionMenu(
            _frame,
            label=_("Type:"),            
            options=_soptions,
            )
        for opt in self.__type_list:
            _w.add_command(opt, label=opt)
        _w.config(variable=self.var_type)
        _w.grid(padx=2)

        _w = Tix.LabelEntry(
            _frame,
            label=_("Name:"),
            options=_eoptions,
            )
        _w.subwidget("entry").configure(textvariable=self.var_name)
        _w.grid(padx=0, ipady=2)
        _w.focus_set()

        _w = Tix.LabelEntry(
            _frame,
            label=_("Value:"),
            options=_eoptions,
            )
        _w.subwidget("entry").configure(textvariable=self.var_value)
        _w.grid(row=2, column=0, ipady=2)

        _frame = Tix.Frame(self, class_="Toolbar")
        _frame.grid()

        _w = Tix.Button(
            _frame,
            text=_("Insert"),
            command=self.__new_item,
            )
        _w.grid(row=0, column=0, padx=10, pady=4)

        _w = Tix.Button(
            _frame,
            text=_("Close"),
            command=self.withdraw,
            )
        _w.grid(row=0, column=1, padx=10, pady=10)
    def __init__(self, mainhandler):
        Tix.Toplevel.__init__(self)
        self.title("Domain Creation Dialog")

        self.mainhandler = mainhandler

        self.name = Tix.LabelEntry(self, label="Domain name")
        self.name.pack(side=Tix.TOP, fill=Tix.X, expand=1)

        bbox = Tix.ButtonBox(self)
        bbox.add("cancel", text="Cancel", command=lambda w=self: w.cancel())
        bbox.add("ok", text="Ok", command=lambda w=self: w.ok())
        bbox.pack(side=Tix.BOTTOM, fill=Tix.X, expand=1)

        self.status = gui_errstr.ErrStr(self)
        self.status.pack(side=Tix.BOTTOM, fill=Tix.X, expand=1)

        self.conn = [
            ConnInfo(self, mainhandler),
            ConnInfo(self, mainhandler, False)
        ]
        self.conn[0].pack(side=Tix.TOP, fill=Tix.BOTH, expand=1)
        self.conn[1].pack(side=Tix.TOP, fill=Tix.BOTH, expand=1)
        self.name.entry.focus()

        self.bind("<Destroy>", self.OnDestroy)

        return
Beispiel #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 tixDirTree 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 DirTree widget. By default it will show the current
        # directory
        #
        #
        top.dir = Tix.DirTree(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 DirTree 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
                                  ''')

        self.dlist_dir = copy.copy(os.curdir)
        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.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)
Beispiel #4
0
 def ProbBound(self, w):
     self.point1_lab = Tix.LabelEntry(w,
                                      label='Point 1:',
                                      options='entry.width 5')
     self.point1_lab.entry.insert(0, '[0,0]')
     #print self.point1_lab.entry.get()
     self.point2_lab = Tix.LabelEntry(w,
                                      label='Point 2:',
                                      options='entry.width 5')
     self.point2_lab.entry.insert(0, '[1,1]')
     self.num_points_lab = Tix.LabelEntry(w,
                                          label='Number of points:',
                                          options='entry.width 5')
     self.num_points_lab.entry.insert(0, '9')
     self.point1_lab.pack(side=Tix.TOP, padx=3, pady=3, fill=Tix.BOTH)
     self.point2_lab.pack(side=Tix.TOP, padx=3, pady=3, fill=Tix.BOTH)
     self.num_points_lab.pack(side=Tix.TOP, padx=3, pady=3, fill=Tix.BOTH)
Beispiel #5
0
    def __show_paras(self, name, typename, var):
        _soptions = ("label.width 15 label.anchor w "
                     "menubutton.width 15 menubutton.relief groove ")
        _coptions = ("label.width 16 label.anchor w "
                     "entry.width 20 entry.relief groove "
                     "decr.relief flat incr.relief flat ")
        _eoptions = ("label.width 16 label.anchor w "
                     "entry.width 20 entry.relief groove ")
        _type = typename
        if _type == "Integer":
            _w = Tix.Control(
                self.__paraframe,
                name=name.lower(),
                label=name,
                variable=var,
                options=_coptions,
            )
            _w.grid(sticky="wen")

        elif _type == "Boolean":
            _w = Tix.OptionMenu(
                self.__paraframe,
                name=name.lower(),
                label=name,
                variable=var,
                options=_soptions,
            )
            _w.add_command("True", label="True")
            _w.add_command("False", label="False")
            _w.grid(sticky="wen")

        elif _type == "Pointer":
            _w = Tix.OptionMenu(
                self.__paraframe,
                name=name.lower(),
                label=name,
                options=_soptions,
            )
            _index = self.__index_of_var(name)
            _option_list = self.__available_var_list(_index)
            for _opt in _option_list:
                _w.add_command(_opt, label=_opt)
            _w.configure(variable=var)
            _w.grid(sticky="wen")

        else:
            _w = Tix.LabelEntry(
                self.__paraframe,
                name=name.lower(),
                label=name,
                options=_eoptions,
            )
            _entry = _w.subwidget("entry")
            _entry.configure(textvariable=var)
            if _type in ("Array", "Record", "Tree"):
                _entry.config(state="readonly", )
            _w.grid(ipady=2, sticky="wen")
        return _w
Beispiel #6
0
 def __init__(self, parent, prop, label):
     self.prop = prop
     self.field = Tix.LabelEntry( parent, label=label,
          options='''
          label.width 30
          label.anchor e
          entry.width 30
          ''' )
     self.field.pack( side=Tix.TOP, padx=20, pady=2 )
Beispiel #7
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())

        group = Tix.LabelEntry(w, label='Newsgroup:', options='entry.width 25')
        group.entry.insert(0,'comp.lang.python')
        pane = Tix.PanedWindow(w, orientation='vertical')

        p1 = pane.add('list', min=70, size=100)
        p2 = pane.add('text', min=70)
        list = Tix.ScrolledListBox(p1)
        list.listbox['width'] = 80
        list.listbox['height'] = 5
        text = Tix.ScrolledText(p2)
        text.text['width'] = 80
        text.text['height'] = 20

        list.listbox.insert(Tix.END, "  12324 Re: Tkinter is good for your health")
        list.listbox.insert(Tix.END, "+ 12325 Re: Tkinter is good for your health")
        list.listbox.insert(Tix.END, "+ 12326 Re: Tix is even better for your health (Was: Tkinter is good...)")
        list.listbox.insert(Tix.END, "  12327 Re: Tix is even better for your health (Was: Tkinter is good...)")
        list.listbox.insert(Tix.END, "+ 12328 Re: Tix is even better for your health (Was: Tkinter is good...)")
        list.listbox.insert(Tix.END, "  12329 Re: Tix is even better for your health (Was: Tkinter is good...)")
        list.listbox.insert(Tix.END, "+ 12330 Re: Tix is even better for your health (Was: Tkinter is good...)")

        text.text['bg'] = list.listbox['bg']
        text.text['wrap'] = 'none'
        text.text.insert(Tix.END, """
    Mon, 19 Jun 1995 11:39:52        comp.lang.python              Thread   34 of  220
    Lines 353       A new way to put text and bitmaps together iNo responses
    [email protected]                Ioi K. Lam at University of Pennsylvania

    Hi,

    I have implemented a new image type called "compound". It allows you
    to glue together a bunch of bitmaps, images and text strings together
    to form a bigger image. Then you can use this image with widgets that
    support the -image option. For example, you can display a text string string
    together with a bitmap, at the same time, inside a TK button widget.
    """)
        text.text['state'] = 'disabled'

        list.pack(expand=1, fill=Tix.BOTH, padx=4, pady=6)
        text.pack(expand=1, fill=Tix.BOTH, padx=4, pady=6)

        group.pack(side=Tix.TOP, padx=3, pady=3, fill=Tix.BOTH)
        pane.pack(side=Tix.TOP, padx=3, pady=3, fill=Tix.BOTH, expand=1)

        box = Tix.ButtonBox(w, orientation=Tix.HORIZONTAL)
        box.add('ok', text='Ok', underline=0, width=6,
                command=self.quitcmd)
        box.add('cancel', text='Cancel', underline=0, width=6,
                command=self.quitcmd)
        box.pack(side=Tix.BOTTOM, fill=Tix.X)
Beispiel #8
0
    def __init__(self,
                 master=None,
                 query="Pick Directory",
                 startDir=None,
                 showHidden=0):
        self.dialog = Tkinter.Frame(master)
        toplevel = self.dialog.winfo_toplevel()
        toplevel.title(query)
        toplevel.protocol('WM_DELETE_WINDOW', self.cancel)
        try:
            self.dialog.tk.call('load', '', 'Tix')
        except Tkinter.TclError:
            self.dialog.tk.call('package', 'require', 'Tix')

        self.dir = Tkinter.StringVar(self.dialog)
        # initialize dir with legal directory
        self.dir.set(os.path.abspath(os.curdir))
        self.dir.trace_variable('w', self.updateDirList)

        keywds = {"value": self.dir.get(), "browsecmd": self.dirBrowse}
        if showHidden:
            keywds["showhidden"] = 1
        self.dirlist = apply(Tix.DirList, (self.dialog, ), keywds)
        self.dirlist.pack(side=Tkinter.TOP, fill=Tkinter.BOTH, expand=1)
        # now set dir to what we want it to start out as
        if startDir:
            self.dir.set(startDir)

        installdir = Tix.LabelEntry(self.dialog,
                                    label=query,
                                    labelside=Tkinter.TOP,
                                    pady=4,
                                    options="entry.width 30 label.anchor w")
        installdir.entry.config(textvariable=self.dir)
        #installdir.entry.bind('<Return>', ??)
        installdir.pack(side=Tkinter.TOP,
                        expand=1,
                        fill=Tkinter.X,
                        anchor=Tkinter.S,
                        padx=4,
                        pady=4)

        box = Tix.ButtonBox(self.dialog, orientation=Tkinter.HORIZONTAL)
        box.add('ok', text='OK', width=6, command=self.ok)
        box.add('cancel', text='Cancel', width=6, command=self.cancel)
        box.pack(side=Tkinter.BOTTOM, fill=Tkinter.X)
        self.dialog.pack(fill=Tkinter.BOTH, expand=1)
Beispiel #9
0
def MkPanedWindow(w):
    """The PanedWindow widget allows the user to interactively manipulate
    the sizes of several panes. The panes can be arranged either vertically
    or horizontally.
    """
    msg = Tix.Message(w,
                      relief=Tix.FLAT, width=240, anchor=Tix.N,
                      text='The PanedWindow widget allows the user to interactively manipulate the sizes of several panes. The panes can be arranged either vertically or horizontally.')
    group = Tix.LabelEntry(w, label='Newsgroup:', options='entry.width 25')
    group.entry.insert(0,'comp.lang.python')
    pane = Tix.PanedWindow(w, orientation='vertical')

    p1 = pane.add('list', min=70, size=100)
    p2 = pane.add('text', min=70)
    list = Tix.ScrolledListBox(p1)
    text = Tix.ScrolledText(p2)

    list.listbox.insert(Tix.END, "  12324 Re: Tkinter is good for your health")
    list.listbox.insert(Tix.END, "+ 12325 Re: Tkinter is good for your health")
    list.listbox.insert(Tix.END, "+ 12326 Re: Tix is even better for your health (Was: Tkinter is good...)")
    list.listbox.insert(Tix.END, "  12327 Re: Tix is even better for your health (Was: Tkinter is good...)")
    list.listbox.insert(Tix.END, "+ 12328 Re: Tix is even better for your health (Was: Tkinter is good...)")
    list.listbox.insert(Tix.END, "  12329 Re: Tix is even better for your health (Was: Tkinter is good...)")
    list.listbox.insert(Tix.END, "+ 12330 Re: Tix is even better for your health (Was: Tkinter is good...)")

    text.text['bg'] = list.listbox['bg']
    text.text['wrap'] = 'none'
    text.text.insert(Tix.END, """
Mon, 19 Jun 1995 11:39:52        comp.lang.python              Thread   34 of  220
Lines 353       A new way to put text and bitmaps together iNo responses
[email protected]                Ioi K. Lam at University of Pennsylvania

Hi,

I have implemented a new image type called "compound". It allows you
to glue together a bunch of bitmaps, images and text strings together
to form a bigger image. Then you can use this image with widgets that
support the -image option. For example, you can display a text string
together with a bitmap, at the same time, inside a TK button widget.
""")
    list.pack(expand=1, fill=Tix.BOTH, padx=4, pady=6)
    text.pack(expand=1, fill=Tix.BOTH, padx=4, pady=6)

    msg.pack(side=Tix.TOP, padx=3, pady=3, fill=Tix.BOTH)
    group.pack(side=Tix.TOP, padx=3, pady=3, fill=Tix.BOTH)
    pane.pack(side=Tix.TOP, padx=3, pady=3, fill=Tix.BOTH, expand=1)
    def createLintWidgets(self):
        lf = Tix.LabelFrame(self)
        lf['label'] = 'Lint'
        lf.pack(side='top',fill='both',expand=1)

        oe = Tix.FileEntry(lf)
        oe['dialogtype'] = 'tixExFileSelectDialog'
        oe['label'] = 'Lint output: (.html)'
        oe.pack(side='top',fill='x',expand=1)
        self.lint_output = Tix.StringVar()
        oe['variable'] = self.lint_output
        oe['command'] = self.lintOutputChanged
        if self.conf.has_option('Lint','output'):
            self.lint_output.set(self.conf.get('Lint','output'))

        ma = Tix.LabelEntry(lf)
        ma['label'] = 'Maximum age:'
        self.max_age = Tix.DoubleVar()
        ma.entry['textvariable'] = self.max_age
        self.max_age.set(0.0)
        ma.pack(side='top')
        

        opts = Tix.Select(lf,allowzero=True)
        opts['label'] = 'Options'
        opts.add('birth',text='birth')
        opts.add('death',text='death')
        opts.pack(side='top',expand=1)
        self.lint_options = Tix.StringVar()
        opts['variable'] = self.lint_options
        
        
        lb = Tix.Button(lf)
        lb['text'] = 'Run Lint'
        lb['command'] = self.runLint
        lb.pack(side='right')
Beispiel #11
0
    def create_main_widgets(self):

        combo_box = Tix.ComboBox(self)
        combo_box.grid(column=0, row=0, sticky='news', padx=4, pady=4)

        button_box = Tix.ButtonBox(self)
        button_box.add('button_1', text='Button_1')
        button_box.add('button_2', text='Button_2')
        button_box.grid(column=0, row=1, sticky='news', padx=4, pady=4)

        control = Tix.Control(self)
        control.grid(column=0, row=2, sticky='news', padx=4, pady=4)

        label_entry = Tix.LabelEntry(self, label="Label for entry")
        label_entry.grid(column=0, row=3, sticky='news', padx=4, pady=4)

        meter = Tix.Meter(self)
        meter.grid(column=0, row=4, sticky='news', padx=4, pady=4)

        options = Tix.OptionMenu(self)
        options.grid(column=0, row=5, sticky='news', padx=4, pady=4)

        file_entry = Tix.FileEntry(self)
        file_entry.grid(column=0, row=6, sticky='news', padx=4, pady=4)
Beispiel #12
0
 def __init__(self, parent, prop, label):
     self.prop = prop
     ## Tix tix for python 3
     if (pythVers < 3):
         self.field = Tix.LabelEntry(parent,
                                     label=label,
                                     options='''
     label.width 12
     label.anchor e
     entry.width 12
     ''')
     else:
         self.field = tix.LabelEntry(parent,
                                     label=label,
                                     options='''
     label.width 12
     label.anchor e
     entry.width 12
     ''')
     ## Tix tix for python 3
     if (pythVers < 3):
         self.field.pack(side=Tix.TOP, padx=8, pady=2)
     else:
         self.field.pack(side=tix.TOP, padx=8, pady=2)
Beispiel #13
0
# -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
    def __init__(self, contype, parent):
        Tix.Frame.__init__(self, parent)
        self.contype = contype
        self.fields = []

        args = OpenIPMI.alloc_empty_args(str(contype))
        self.args = args

        self.errstr = gui_errstr.ErrStr(self)
        self.errstr.pack(side=Tix.TOP, fill=Tix.X, expand=1)

        i = 0
        rv = 0
        frame = None
        while (rv == 0):
            name = [""]
            vtype = [""]
            vrange = [""]
            vhelp = [""]
            value = [""]
            rv = args.get_val(i, name, vtype, vhelp, value, vrange)
            if (rv == 0):
                if (vhelp[0][0] == '*'):
                    optional = False
                    vhelp[0] = vhelp[0][1:]
                else:
                    optional = True
                    pass
                if (vhelp[0][0] == '!'):
                    password = True
                    vhelp[0] = vhelp[0][1:]
                else:
                    password = False
                    pass

                if (vtype[0] == "bool"):
                    if (frame == None):
                        didframe = True
                        frame = Tix.Frame(self)
                        frame.pack(side=Tix.TOP)
                        newframe = frame
                        pass
                    else:
                        newframe = None
                        pass
                    fw = Tix.BooleanVar()
                    w = Tix.Checkbutton(frame, text=name[0], variable=fw)
                    w.pack(side=Tix.LEFT, padx=10)
                    if ((value[0] != None) and (value[0] == "true")):
                        fw.set(True)
                        pass
                    pass
                elif (vtype[0] == "enum"):
                    do_box = False
                    fw = EnumHolder()
                    if (value[0] != None):
                        fw.set(value[0])
                        pass
                    else:
                        fw.set(vrange[0])
                        pass
                    w = Tix.Select(self,
                                   label=name[0],
                                   allowzero=0,
                                   radio=1,
                                   command=fw.SelectType)
                    for v in vrange:
                        w.add(v, text=v)
                        pass
                    newframe = None
                    w.invoke(fw.get())
                    w.pack()
                    pass
                elif (vtype[0] == "str") or (vtype[0] == "int"):
                    if (frame == None):
                        didframe = True
                        frame = Tix.Frame(self)
                        frame.pack(side=Tix.TOP)
                        newframe = frame
                        pass
                    else:
                        newframe = None
                        pass

                    if (value[0] == None):
                        value[0] = ""
                        pass
                    if (password):
                        options = "entry.show '*' entry.width 20"
                    else:
                        options = "entry.width 20"
                        pass
                    w = Tix.LabelEntry(frame, label=name[0], options=options)
                    w.entry.insert(Tix.END, value[0])
                    w.pack(side=Tix.LEFT, padx=10)
                    fw = w.entry
                    pass
                else:
                    i += 1
                    continue
                frame = newframe
                self.fields.append((i, name[0], vtype[0], fw))
                pass
            i += 1
            pass

        return
Beispiel #15
0
def configureGUI():
    global packetHistory, maxSizeControl, toSendEntry, baudRateOptionMenu, timeoutControl, receiveOptionMenu
    global transmitOptionMenu, maxSizeControl, packetHeaderEntry, portStringOptionMenu, transmitButton

    root.title(
        '::: MIT Media Lab ::: Responsive Environments Group ::: Serial Terminal :::'
    )

    # -- window setup
    mainFrame = Tix.Frame(root, width=WIDTH, height=HEIGHT)
    mainFrame.bind(sequence='<Destroy>', func=windowDestroyed)
    mainFrame.pack(fill=Tix.BOTH)

    # -- packet history display setup
    packetHistory = Tix.Text(mainFrame, height=WINDOW_HEIGHT)
    packetHistory.config(state=Tix.DISABLED, font='courier')

    # -- transmit packet entry setup
    transmitFrame = Tix.Frame(mainFrame)
    transmitButton = Tix.Button(master=transmitFrame,
                                text="Transmit packet: ",
                                command=sendUserPacket,
                                state=Tix.DISABLED)
    toSendEntry = Tix.Entry(master=transmitFrame,
                            textvariable=transmitPacketString)
    transmitButton.pack(side=Tix.TOP, fill=Tix.X)
    toSendEntry.pack(side=Tix.TOP, fill=Tix.X)

    # -- conrols setup
    controlsFrame = Tix.Frame(mainFrame)

    # -- serial port controls setup
    serialPortControlsLabelFrame = Tix.LabelFrame(controlsFrame,
                                                  label="Serial Port Settings")
    serialPortControlsFrame = serialPortControlsLabelFrame.frame
    openOrCloseButton = Tix.Button(master=serialPortControlsFrame,
                                   text="Open",
                                   command=openOrCloseConnection,
                                   width=5,
                                   textvariable=openOrCloseString)
    openOrCloseButton.pack(fill=Tix.X, side=Tix.TOP)
    portStringOptionMenu = Tix.OptionMenu(
        master=serialPortControlsFrame,
        label="Serial port: ",
        variable=portString,
        options=
        'label.width 25 label.anchor e menubutton.width 15 menubutton.anchor w'
    )
    for p in range(4):
        portStringOptionMenu.add_command(candidates[p], label=candidates[p])
    portStringOptionMenu.pack(fill=Tix.X, side=Tix.TOP)
    baudRateOptionMenu = Tix.OptionMenu(
        master=serialPortControlsFrame,
        label="Baud rate: ",
        variable=baudRateString,
        options=
        'label.width 25 label.anchor e menubutton.width 15 menubutton.anchor w'
    )
    ## TODO : The enumeration of baud rates should come from the 'serial' module.
    for r in [300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200]:
        baudRateOptionMenu.add_command(r, label=r)
    baudRateOptionMenu.pack(fill=Tix.X, side=Tix.TOP)
    timeoutControl = Tix.Control(serialPortControlsFrame,
                                 label="Packet timeout (seconds): ",
                                 variable=packetTimeout,
                                 min=0,
                                 inc=lambda x: float(x) + 0.001,
                                 dec=lambda x: float(x) - 0.001)
    timeoutControl.label.config(width=25, anchor='e')
    timeoutControl.pack(fill=Tix.X, side=Tix.TOP)
    serialPortControlsLabelFrame.pack(side=Tix.LEFT)

    # -- packet controls setup
    packetControlsLabelFrame = Tix.LabelFrame(controlsFrame,
                                              label="Packet Settings")
    packetControlsFrame = packetControlsLabelFrame.frame
    receiveOptionMenu = Tix.OptionMenu(
        master=packetControlsFrame,
        label="Decode receptions as: ",
        variable=receiveMode,
        command=updateHeader,
        options=
        'label.width 25 label.anchor e menubutton.width 15 menubutton.anchor w'
    )
    for choice in receiveFilters.keys():
        receiveOptionMenu.add_command(choice, label=choice)
    receiveOptionMenu.pack(fill=Tix.X, side=Tix.TOP)
    transmitOptionMenu = Tix.OptionMenu(
        master=packetControlsFrame,
        label="Encode transmissions as: ",
        variable=transmitMode,
        options=
        'label.width 25 label.anchor e menubutton.width 15 menubutton.anchor w'
    )
    for choice in transmitFilters.keys():
        transmitOptionMenu.add_command(choice, label=choice)
    transmitOptionMenu.pack(fill=Tix.X, side=Tix.TOP)
    packetHeaderEntry = Tix.LabelEntry(
        packetControlsFrame,
        label="Look for packet header: ",
        options='label.width 25 label.anchor e entry.width 15 entry.anchor w')
    packetHeaderEntry.entry.config(textvariable=packetHeaderString)
    packetHeaderEntry.pack(fill=Tix.X, side=Tix.TOP)
    maxSizeControl = Tix.Control(packetControlsFrame,
                                 label="Max packet size (bytes): ",
                                 variable=maxPacketSize,
                                 min=1)
    maxSizeControl.label.config(width=25, anchor='e')
    maxSizeControl.pack(fill=Tix.X, side=Tix.TOP)
    packetControlsLabelFrame.pack(side=Tix.RIGHT)

    # -- pack the window up
    packetHistory.pack(fill=Tix.BOTH, side=Tix.TOP)
    transmitFrame.pack(fill=Tix.X, side=Tix.TOP)
    controlsFrame.pack(side=Tix.BOTTOM, fill=Tix.X)

    # -- menu bar setup
    mainMenu = Tix.Menu(root)

    # -- file menu
    fileMenu = Tix.Menu(mainMenu, tearoff=0)
    fileMenu.add_separator()
    fileMenu.add_command(label="Quit", command=quit)
    mainMenu.add_cascade(label="File", menu=fileMenu)

    # -- info menu
    infoMenu = Tix.Menu(mainMenu, tearoff=0)
    infoMenu.add_command(label="About...")
    mainMenu.add_cascade(label="Help", menu=infoMenu)

    # -- add menu to frame
    root.config(menu=mainMenu)

    # -- set global variable defaults
    receiveMode.set(oldReceiveMode)
    transmitMode.set(oldTransmitMode)
    maxPacketSize.set(38)
    packetTimeout.set(0.001)
    portString.set(candidates[0])
    baudRateString.set(115200)
    openOrCloseString.set('Open')
Beispiel #16
0
# -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
Beispiel #17
0
    def __create_property_window(self):
        self.__property = Tkinter.Toplevel(self.widget)
        self.__property.title(_("Properties"))
        self.__property.resizable(False, False)
        self.__property.protocol('WM_DELETE_WINDOW', False)
        _frame = Tkinter.Frame(self.__property)
        _frame.grid(pady=2)

        _soptions = ("label.width 15 label.anchor e "
                     "menubutton.width 15 menubutton.relief groove ")
        _coptions = ("label.width 16 label.anchor e "
                     "entry.width 20 entry.relief groove "
                     "decr.relief flat incr.relief flat ")
        _eoptions = ("label.width 16 label.anchor e "
                     "entry.width 20 entry.relief groove ")

        self.__var_index = Tkinter.IntVar()
        _w = Tix.Control(
            _frame,
            label=_("Index") + " : ",
            integer=1,
            variable=self.__var_index,
            min=0,
            max=100,
            options=_coptions,
        )
        _w.grid(sticky="wen")
        self.__control_index = _w

        self.__var_name = Tkinter.StringVar()
        _w = Tix.LabelEntry(
            _frame,
            label=_("Name") + " : ",
            options=_eoptions,
        )
        _w.subwidget("entry").config(
            textvariable=self.__var_name,
            state="disabled",
        )
        self.__var_name.set("")
        _w.grid(ipady=2, sticky="wen")

        self.__var_type = Tkinter.StringVar()
        _w = Tix.LabelEntry(
            _frame,
            label=_("Type") + " : ",
            options=_eoptions,
        )
        _w.subwidget("entry").config(
            textvariable=self.__var_type,
            state="disabled",
        )
        _w.grid(ipady=2, sticky="wen")

        _option_list = ("True", "False")
        self.__var_visible = Tkinter.StringVar()
        _w = Tix.OptionMenu(
            _frame,
            label=_("Visible") + " :",
            variable=self.__var_visible,
            options=_soptions,
        )
        for _opt in _option_list:
            _w.add_command(_opt, label=_opt)
        self.__var_visible.set(_option_list[0])
        _w.grid(sticky="wen")

        self.__var_width = Tkinter.IntVar()
        self.__var_width.set(40)
        _w = Tix.Control(
            _frame,
            label=_("Width") + " : ",
            integer=1,
            variable=self.__var_width,
            min=40,
            max=1024,
            options=_coptions,
        )
        _w.grid(sticky="wen")

        self.__var_height = Tkinter.IntVar()
        self.__var_height.set(40)
        _w = Tix.Control(
            _frame,
            label=_("Heigth") + " : ",
            integer=1,
            variable=self.__var_height,
            min=40,
            max=1024,
            options=_coptions,
        )
        _w.grid(sticky="wen")

        _option_list = ("oval", "renctangle")
        self.__var_shape = Tkinter.StringVar()
        _w = Tix.OptionMenu(
            _frame,
            label=_("Shape") + " :",
            variable=self.__var_shape,
            options=_soptions,
        )
        for _opt in _option_list:
            _w.add_command(_opt, label=_opt)
        self.__var_shape.set(_option_list[0])
        _w.grid(sticky="wen")

        _option_list = self.__available_var_list(-1)
        self.__var_watch = Tkinter.StringVar()
        _w = Tix.OptionMenu(
            _frame,
            label=_("Watch") + " :",
            variable=self.__var_watch,
            options=_soptions,
        )
        for _opt in _option_list:
            _w.add_command(_opt, label=_opt)
        self.__var_watch.set(_option_list[0])
        _w.grid(sticky="wen")

        _option_list = ("horizontal", "vertical")
        self.__var_orientation = Tkinter.StringVar()
        _w = Tix.OptionMenu(
            _frame,
            label=_("Orientation") + " :",
            variable=self.__var_orientation,
            options=_soptions,
        )
        for _opt in _option_list:
            _w.add_command(_opt, label=_opt)
        self.__var_orientation.set(_option_list[0])
        _w.grid(sticky="wen")

        _option_list = ("n", "ne", "e", "se", "s", "sw", "w", "nw", "center")
        self.__var_anchor = Tkinter.StringVar()
        _w = Tix.OptionMenu(
            _frame,
            label=_("Anchor") + " :",
            variable=self.__var_anchor,
            options=_soptions,
        )
        for _opt in _option_list:
            _w.add_command(_opt, label=_opt)
        self.__var_anchor.set(_option_list[0])
        _w.grid(sticky="wen")

        self.__var_padx = Tkinter.IntVar()
        _w = Tix.Control(
            _frame,
            label=_("Padx") + " : ",
            integer=1,
            variable=self.__var_padx,
            min=0,
            max=100,
            options=_coptions,
        )
        _w.grid(sticky="wen")

        self.__var_pady = Tkinter.IntVar()
        _w = Tix.Control(
            _frame,
            label=_("Pady") + " : ",
            integer=1,
            variable=self.__var_pady,
            min=0,
            max=100,
            options=_coptions,
        )
        _w.grid(sticky="wen")

        self.__var_xincrement = Tkinter.IntVar()
        _w = Tix.Control(
            _frame,
            label=_("Xincrement") + " : ",
            integer=1,
            variable=self.__var_xincrement,
            min=-100,
            max=100,
            options=_coptions,
        )
        _w.grid(sticky="wen")

        self.__var_yincrement = Tkinter.IntVar()
        _w = Tix.Control(
            _frame,
            label=_("Yincrement") + " : ",
            integer=1,
            variable=self.__var_yincrement,
            min=-100,
            max=100,
            options=_coptions,
        )
        _w.grid(sticky="wen")

        self.__var_size = Tkinter.IntVar()
        _w = Tix.Control(
            _frame,
            label=_("Size") + " : ",
            integer=1,
            variable=self.__var_size,
            min=0,
            max=100,
            options=_coptions,
        )
        _w.grid(sticky="wen")

        _option_list = ("True", "False")
        self.__var_anonymous = Tkinter.StringVar()
        _w = Tix.OptionMenu(
            _frame,
            label=_("Anonymous") + " :",
            variable=self.__var_anonymous,
            options=_soptions,
        )
        for _opt in _option_list:
            _w.add_command(_opt, label=_opt)
        self.__var_anonymous.set(_option_list[0])
        _w.grid(sticky="wen")

        self.widget.update_idletasks()
        x = self.widget.winfo_rootx() + 550
        y = self.widget.winfo_rooty() + 100
        self.__property.geometry("+%d+%d" % (x, y))
        self.widget.update_idletasks()
        self.__property.transient(self.widget)
Beispiel #18
0
    def __create_widgets(self, namelist):
        _soptions = ("label.width 20 label.anchor w "
                     "menubutton.width 15 menubutton.relief groove "
                     "menubutton.borderwidth 1 ")
        _eoptions = ("entry.width 20 entry.borderwidth 1 entry.relief groove "
                     "label.width 20 label.anchor w label.padx 0 ")

        _frame = Tkinter.Frame(self, borderwidth=2, relief="groove")
        _frame.grid(padx=2, pady=2, ipady=2, sticky="nesw")

        _w = Tix.OptionMenu(
            _frame,
            label=_("Type"),
            variable=self.var_type,
            options=_soptions,
        )
        for opt in self.__type_list:
            _w.add_command(opt, label=opt)
        _w.grid(padx=2)

        _w = Tix.LabelEntry(
            _frame,
            label=_("Name"),
            options=_eoptions,
        )
        _w.subwidget("entry").configure(textvariable=self.var_name)
        _w.grid(padx=0, ipady=2)

        _w = Tix.LabelEntry(
            _frame,
            label=_("Value"),
            options=_eoptions,
        )
        _w.subwidget("entry").configure(textvariable=self.var_value)
        _w.grid(row=2, column=0, ipady=2)
        self.__labelentry_value = _w

        _w = Tix.OptionMenu(
            _frame,
            label=_("Value"),
            options=_soptions,
        )
        for opt in namelist:
            _w.add_command(opt, label=opt)
        _w.grid(row=2, column=0, padx=2)
        self.__optionmenu_pointer = _w

        _w = Tix.OptionMenu(
            _frame,
            label=_("Value"),
            options=_soptions,
        )
        for opt in ("True", "False"):
            _w.add_command(opt, label=opt)
        _w.grid(row=2, column=0, padx=2)
        self.__optionmenu_boolean = _w

        _frame = Tkinter.Frame(self)
        _frame.grid()

        _w = Tkinter.Button(_frame,
                            text=_("OK"),
                            overrelief="groove",
                            width=8,
                            command=self.quit)
        _w.grid(row=0, column=0, padx=10, pady=4)

        _w = Tkinter.Button(
            _frame,
            text=_("Cancel"),
            overrelief="groove",
            command=lambda: (self.var_type.set("") or self.quit()),
            width=8,
        )
        _w.grid(row=0, column=1, padx=10, pady=10)
Beispiel #19
0
    def __init__(self, name, num_vals, light_list, vals, handler):
        self.handler = handler
        self.light_list = light_list
        Tix.Toplevel.__init__(self)
        self.title(name)

        svalues = Tix.ScrolledWindow(self)
        self.values = svalues.window
        self.lights = []

        row = 0
        for i in range(0, num_vals):
            if (len(vals) <= i):
                ivals = ("", "black", '0', '1')
            else:
                ivals = vals[i]
                pass

            label = Tix.Label(self.values, text="Light " + str(i))
            label.grid(row=row, column=0, sticky="e")
            if (light_list[i][0]):
                lc = Tix.BooleanVar()
                lcw = Tix.Checkbutton(self.values,
                                      text="Local Control",
                                      variable=lc)
                lc.set(ivals[0] == "lc")
                lcw.grid(row=row, column=1, sticky="ew")
                row += 1
            else:
                lc = None
                pass

            color = EnumHolder()
            colorw = Tix.Select(self.values,
                                label="Color",
                                allowzero=0,
                                radio=1,
                                command=color.SelectType)
            for v in light_list[i][1]:
                colorw.add(v, text=v)
                pass
            colorw.configure(value=ivals[1])
            colorw.grid(row=row, column=1, sticky="ew")
            row += 1

            ontime = Tix.LabelEntry(self.values, label="On Time")
            ontime.entry.insert("0", ivals[2])
            ontime.grid(row=row, column=1, sticky="ew")
            row += 1
            ontime = ontime.entry

            offtime = Tix.LabelEntry(self.values, label="Off Time")
            offtime.entry.insert("0", ivals[3])
            offtime.grid(row=row, column=1, sticky="ew")
            row += 1
            offtime = offtime.entry

            self.lights.append((lc, color, ontime, offtime))
            pass

        svalues.pack(side=Tix.TOP, fill=Tix.BOTH, expand=1)

        bbox = Tix.ButtonBox(self)
        bbox.add("cancel", text="Cancel", command=lambda w=self: w.cancel())
        bbox.add("ok", text="Ok", command=lambda w=self: w.ok_press())
        bbox.pack(side=Tix.BOTTOM, fill=Tix.X, expand=1)

        self.bind("<Destroy>", self.OnDestroy)
        return
Beispiel #20
0
# -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
Beispiel #21
0
    def __create_property_window(self, frame):
        _soptions = ("label.width 15 label.anchor e label.relief flat "
                     "menubutton.width 15 menubutton.relief groove")
        _coptions = ("label.width 16 label.anchor e "
                     "entry.width 20 relief groove "
                     "decr.relief flat incr.relief flat ")
        _eoptions = ("label.width 16 label.anchor e "
                     "entry.width 20 relief groove")

        boolean_list = ("False", "True")

        v = Tix.StringVar()
        self.var_list["type"] = v

        v = Tix.StringVar()
        self.var_list["value"] = v

        v = Tix.IntVar()
        self.var_list["visible"] = v

        v = Tix.IntVar()
        self.var_list["width"] = v

        v = Tix.IntVar()
        self.var_list["height"] = v

        v = Tix.StringVar()
        self.var_list["orientation"] = v

        v = Tix.IntVar()
        self.var_list["padx"] = v

        v = Tix.IntVar()
        self.var_list["pady"] = v

        v = Tix.IntVar()
        self.var_list["xincrement"] = v

        v = Tix.IntVar()
        self.var_list["yincrement"] = v

        v = Tix.StringVar()
        self.var_list["shape"] = v

        v = Tix.StringVar()
        self.var_list["anchor"] = v

        v = Tix.IntVar()
        self.var_list["anonymous"] = v

        v = Tix.IntVar()
        self.var_list["size"] = v

        w = Tix.OptionMenu(
            frame,
            label=_("Type:"),
            options=_soptions,
            )
        for opt in TYPE_LIST:
            w.add_command(opt, label=opt)
        w.configure(variable=self.var_list["type"])
        w.grid(sticky="wen")

        w = Tix.LabelEntry(
            frame,
            label=_("Value:"),
            options=_eoptions,
            )
        w.entry.config(
            textvariable=self.var_list["value"],
            )
        # w.grid(sticky="wen")

        w = Tix.Text(
            frame,
            width=40,
            height=10,
            state="disabled",
            )
        # w.grid(pady=2, sticky="nesw")
        self.value_text = w

        w = Tix.OptionMenu(
            frame,
            label=_("Visible:"),
            options=_soptions,
            )
        for i in (0, 1):
            w.add_command(str(i), label=boolean_list[i])
        w.configure(variable=self.var_list["visible"])
        w.grid(sticky="wen")

        _option_list = ("oval", "renctangle")
        _w = Tix.OptionMenu(
            frame,
            label=_("Shape:"),
            variable=self.var_list["shape"],
            options=_soptions,
            )
        for _opt in _option_list:
            _w.add_command(_opt, label=_opt)
        _w.grid(sticky="wen")

        _w = Tix.Control(
            frame,
            label=_("Width:"),
            integer=1,
            variable=self.var_list["width"],
            min=40,
            max=1024,
            options=_coptions,
            )
        _w.grid(sticky="wen")

        _w = Tix.Control(
            frame,
            label=_("Heigth:"),
            integer=1,
            variable=self.var_list["height"],
            min=40,
            max=1024,
            options=_coptions,
            )
        _w.grid(sticky="wen")

        _w = Tix.Control(
            frame,
            label=_("Array Size:"),
            integer=1,
            variable=self.var_list["size"],
            min=0,
            max=100,
            options=_coptions,
            )
        _w.grid(sticky="wen")

        _w = Tix.Control(
            frame,
            label=_("Padx:"),
            integer=1,
            variable=self.var_list["padx"],
            min=0,
            max=100,
            options=_coptions,
            )
        _w.grid(sticky="wen")

        _w = Tix.Control(
            frame,
            label=_("Pady:"),
            integer=1,
            variable=self.var_list["pady"],
            min=0,
            max=100,
            options=_coptions,
            )
        _w.grid(sticky="wen")

        _w = Tix.Control(
            frame,
            label=_("Xincrement:"),
            integer=1,
            variable=self.var_list["xincrement"],
            min=-100,
            max=100,
            options=_coptions,
            )
        _w.grid(sticky="wen")

        _w = Tix.Control(
            frame,
            label=_("Yincrement:"),
            integer=1,
            variable=self.var_list["yincrement"],
            min=-100,
            max=100,
            options=_coptions,
            )
        _w.grid(sticky="wen")

        w = Tix.OptionMenu(
            frame,
            label=_("Anonymous:"),
            options=_soptions,
            )
        for i in (0, 1):
            w.add_command(str(i), label=boolean_list[i])
        w.configure(variable=self.var_list["anonymous"])
        w.grid(sticky="wen")
        
        _option_list = ("horizontal", "vertical")
        _w = Tix.OptionMenu(
            frame,
            label=_("Orientation:"),
            variable=self.var_list["orientation"],
            options=_soptions,
            )
        for _opt in _option_list:
            _w.add_command(_opt, label=_opt)
        _w.grid(sticky="wen")

        _option_list = ("n", "ne", "e", "se", "s", "sw", "w", "nw", "center")
        _w = Tix.OptionMenu(
            frame,
            label=_("Anchor:"),
            variable=self.var_list["anchor"],
            options=_soptions,
            )
        for _opt in _option_list:
            _w.add_command(_opt, label=_opt)
        _w.grid(sticky="wen")

        # 设定默认值以及变更跟踪
        for k, v in self.var_list.iteritems():
            v.set(self.empty_item[k])
            if k == "size":
                v.trace_variable("w", self.__change_array_size)
            else:
                v.trace_variable("w", lambda i,v,m,k=k:self.__change_option_value(k))
Beispiel #22
0
    def __init__(self, w):
        

        #
        #  defaults that can be overridden
        #

        self.options = {'initwait' : BALLOONWAIT,
                        'floatwin' : FLOATONTOP}
        
        for option in self.options.keys():
            setattr(self,option,self.options[option])
            
        
        #
        #  where am I
        #
        self.path = sys.path[0]
        path1, path2 = os.path.split(self.path)
        if path2 == "library.zip":
            self.path=path1

        #
        # crap for organizing orderly shutdown
        #
        z = w.winfo_toplevel()
        z.wm_protocol("WM_DELETE_WINDOW", lambda self=self: self.shutdown())
        self.exit = -1
        self.root = w
        #
        # the help balloon
        #
        balloon = Tix.Balloon(w, initwait=self.initwait)
        #
        #  folderFrame line: an entry for the folder where the files are
        #
        folderFrame = Tix.Frame(w)
        
        self.folderName = StringVar()
        self.treesFileName = StringVar()
        self.floatWin = IntVar()
        self.floatWin.set(FLOATONTOP)
        
        #
        # make window float or not
        #
        if sys.platform[0:3]=="win":
            self.floatWin.set(self.floatwin)

        def setFolder(event, self=self):
            name = self.dirLabelEntry.entry.get()
            self.folderName.set(name)
            self.treesFileDialog.fsbox.config(directory=name)
            self.treesFileName.set("")
            self.texFileName.set("")

        self.dirLabelEntry = dirLabelEntry= Tix.LabelEntry(folderFrame, takefocus=0, 
           label='Folder: ',  options = '''entry.width 20 label.width 9 label.anchor e''')
        dirLabelEntry.entry["textvariable"] = self.folderName
        dirLabelEntry.entry.bind("<KeyPress-Return>", setFolder)
        dirLabelEntry.pack(side=RIGHT, expand=YES, fill=X)
        balloon.bind_widget(dirLabelEntry,
          msg="You can enter the directory for the trees file here, but it's usually better to browse with the '...' button below.\n")
        folderFrame.pack(side=TOP, expand=YES, fill=X)
        #
        # next line: the Trees file
        #
        treesFrame = Tix.Frame(w)
        self.treesLabelEntry = treesLabelEntry = Tix.LabelEntry(treesFrame, label = " Trees file: ", options = '''
                                      entry.width 20
                                      label.width 9 label.anchor e
                                      ''')

        treesLabelEntry.entry["textvariable"] = self.treesFileName
        
        def treesFileCommand(filePath, self=self):
            dirName, fileName = os.path.split(filePath)
            self.treesFileName.set(fileName)
            if dirName!=self.folderName.get():
#                print dirName
#                print self.folderName.get()
                self.folderName.set(dirName)        

        self.treesFileDialog = treesFileDialog = Tix.ExFileSelectDialog(root, title="Trees File Selection", command=treesFileCommand)
        self.treesFileDialog.fsbox.config(pattern="*.txp")

        def selectTreesFile(dialog=treesFileDialog):
            dialog.popup()

        linepattern = re.compile("\s*(.+?)\s*=\s*(.+?)\s*$")
        #
        # load up history
        #
        self.historypath = historypath = os.path.join(self.path, "TreeButton.cfg")
        if os.path.exists(historypath):
            history = open(historypath,"r")
            line = history.readline()
            treesdir = treesFileDialog.fsbox.dir
            while line != "":
                linematch = linepattern.match(line)
                if linematch:
                    if linematch.group(1)=="treesfolder":
                        treesdir.insert(0,linematch.group(2))
                    elif linematch.group(1)=="folder":
                        self.folderName.set(linematch.group(2))
                    elif linematch.group(1)=="treesfile":
                        self.treesFileName.set(linematch.group(2))
                    else:
                        item = linematch.group(1)
                        if item == "floatwin":
                            self.floatWin.set(int(linematch.group(2)))
                        elif item in self.options.keys():
                            setattr(self,item,linematch.group(2))
                        else:
                            print "Unknown Setup Option: %s"%line
                else:
                    print 'matchless: '+line
                line = history.readline()
        for dialog in (treesFileDialog,):
            box = dialog.fsbox
            list = box.dir.slistbox.listbox
            if list.size()>0:
                box.config(directory=list.get(0))
  
        tbt = Tix.Button(treesFrame,text="...", command=selectTreesFile)
        tbt.pack(side=RIGHT)
        treesLabelEntry.pack(side=RIGHT, expand=YES, fill=X)
        treesFrame.pack(side=TOP, expand=YES, fill=X)
        #
        # bottom line: the view buttons
        #
        runButFrame = Tix.Frame(w)

        def treesCommand(self=self):
            os.chdir(self.folderName.get())
            treesFile = self.treesFileName.get()
            base, ext = os.path.splitext(treesFile)
            treesout = base+".tex"
            global errfilename
            trees.errfilename = base+".err"
            if 1:
                infile = open(treesFile, "r")
                outfile = open(treesout, "w")
                trees.process_file(trees.Source(infile), outfile)
                if trees.error_occurred:
                    print "Trees had a problem"
                    return
                else:
                   print "Trees ran without issues"
                outfile.close()

        treesButFrame = Tix.Frame(runButFrame)
        txb = Tix.Button(treesButFrame, text="Run Trees", command=treesCommand)
        txb.pack(side=LEFT, anchor=W)
        

        if sys.platform[0:3]=="win":
#            floatFrame = Tix.Frame(w)
            floatLabel = Tix.Label(treesButFrame, text="Keep TreeButton on top")
            floatLabel.pack(side=RIGHT, anchor=E)
            floatCheck = Tix.Checkbutton(treesButFrame, variable=self.floatWin,
               command=lambda self=self: self.checkFloat())
            floatCheck.pack(side=RIGHT, anchor=E)
#            floatFrame.pack(side=TOP, anchor=W)
            
        treesButFrame.pack(side=LEFT,anchor=N)
        
        runButFrame.pack(side=TOP)

            
        if sys.platform[0:3]=="win":
 #       if 0:  # disable this stuff for now
            menubar = Menu(w)
            w.configure(menu = menubar)
            system_menu = Menu(menubar, tearoff=0, name="system")
            system_menu.add_separator()
            for (label, command) in [("Run trees", treesCommand),
                                     ]:
                system_menu.add_command(label=label, command=command)
            menubar.add_cascade(menu = system_menu)


        #
        # load icon if possible  s/b late to avoid goofy-looking startup
        #
        iconpath = os.path.join(self.path,'treerunner.ico')
        if os.path.exists(iconpath):
            self.iconpath = iconpath
            try:
                z.wm_iconbitmap(bitmap=iconpath)
            except:
                pass
        else:
            self.iconpath = None
        #
        # ready to rock and roll
        #
        print "TreeButton is ready."
Beispiel #23
0
# -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-