コード例 #1
0
ファイル: tixwidgets.py プロジェクト: Geniuspp/python
def MkSList(w):
    """This TixScrolledListBox is configured so that it uses scrollbars
    only when it is necessary. Use the handles to resize the listbox and
    watch the scrollbars automatically appear and disappear.  """
    top = Tix.Frame(w, width=300, height=330)
    bot = Tix.Frame(w)
    msg = Tix.Message(top,
                      relief=Tix.FLAT, width=200, anchor=Tix.N,
                      text='This TixScrolledListBox is configured so that it uses scrollbars only when it is necessary. Use the handles to resize the listbox and watch the scrollbars automatically appear and disappear.')

    list = Tix.ScrolledListBox(top, scrollbar='auto')
    list.place(x=50, y=150, width=120, height=80)
    list.listbox.insert(Tix.END, 'Alabama')
    list.listbox.insert(Tix.END, 'California')
    list.listbox.insert(Tix.END, 'Montana')
    list.listbox.insert(Tix.END, 'New Jersey')
    list.listbox.insert(Tix.END, 'New York')
    list.listbox.insert(Tix.END, 'Pennsylvania')
    list.listbox.insert(Tix.END, 'Washington')

    rh = Tix.ResizeHandle(top, bg='black',
                          relief=Tix.RAISED,
                          handlesize=8, gridded=1, minwidth=50, minheight=30)
    btn = Tix.Button(bot, text='Reset', command=lambda w=rh, x=list: SList_reset(w,x))
    top.propagate(0)
    msg.pack(fill=Tix.X)
    btn.pack(anchor=Tix.CENTER)
    top.pack(expand=1, fill=Tix.BOTH)
    bot.pack(fill=Tix.BOTH)
    list.bind('<Map>', func=lambda arg=0, rh=rh, list=list:
              list.tk.call('tixDoWhenIdle', str(rh), 'attachwidget', str(list)))
コード例 #2
0
 def __init__(self, parent):
     Tix.Frame.__init__(self, parent)
     self.slider = []
     self.master_override = Tix.IntVar(self)
     self.master_override.set(0)
     frame = Tix.Frame(self)
     frame.pack(side=Tix.TOP, expand=True, fill=Tix.X)
     self.master_check = Tix.Checkbutton(frame,
                                         text='override',
                                         variable=self.master_override,
                                         command=self.Toggle)
     self.master_check.pack(side=Tix.LEFT)
     self.master_var = Tix.DoubleVar(self)
     self.master_var.set(0)
     self.master_scale = Tix.Scale(frame,
                                   orient=Tix.HORIZONTAL,
                                   variable=self.master_var,
                                   showvalue=0,
                                   from_=0,
                                   to=100,
                                   command=self._UpdateMaster)
     self.master_scale.pack(side=Tix.LEFT, expand=True, fill=Tix.X)
     Tix.Label(frame, textvariable=self.master_var,
               width=12).pack(side=Tix.LEFT)
     self.gframe = Tix.Frame(self)
     self.gframe.pack(side=Tix.TOP, expand=True, fill=Tix.X)
コード例 #3
0
def MkSWindow(w):
    global demo

    top = Tix.Frame(w, width=330, height=330)
    bot = Tix.Frame(w)
    msg = Tix.Message(top, font='-*-helvetica-bold-r-normal-*-14-*-*-*-*-*-*-*',
		      relief=Tix.FLAT, width=200, anchor=Tix.N,
		      text='The TixScrolledWindow widget allows you to scroll any kind of Tk widget. It is more versatile than a scrolled canvas widget.')
    win = Tix.ScrolledWindow(top, scrollbar='auto')
    image = Tix.Image('photo', file=demo.dir + "/bitmaps/tix.gif")
    lbl = Tix.Label(win.window, image=image)
    lbl.pack(expand=1, fill=Tix.BOTH)

    win.place(x=30, y=150, width=190, height=120)

    rh = Tix.ResizeHandle(top, bg='black',
			  relief=Tix.RAISED,
			  handlesize=8, gridded=1, minwidth=50, minheight=30)
    btn = Tix.Button(bot, text='Reset', command=lambda w=rh, x=win: SWindow_reset(w,x))
    top.propagate(0)
    msg.pack(fill=Tix.X)
    btn.pack(anchor=Tix.CENTER)
    top.pack(expand=1, fill=Tix.BOTH)
    bot.pack(fill=Tix.BOTH)
    win.bind('<Map>', func=lambda arg=0, rh=rh, win=win:
	     win.tk.call('tixDoWhenIdle', str(rh), 'attachwidget', str(win)))
コード例 #4
0
 def __init__(self, root, notebook):
     Tix.Frame.__init__(self, root)
     bbox = Tix.Frame(self)
     bts = [
         Tix.Button(bbox, text=t, command=c) for t, c in [
             ("<<", self.reverse),
             (">>", self.forward),
             ("+", self.plus),
             ("-", self.minus),
         ]
     ]
     bbox.pack(side=Tix.TOP, fill=Tix.X)
     for bt in bts:
         bt.pack(side=Tix.LEFT, fill=Tix.X)
     tlist = Tix.TList(self)
     tlist.pack(expand=1, fill=Tix.BOTH, pady=10, side=Tix.TOP)
     bbox = Tix.Frame(self)
     bts = [
         Tix.Button(bbox, text=t, command=c) for t, c in [
             ("Save", self.save),
             ("Load", self.load),
             ("Clear", self.clear),
         ]
     ]
     bbox.pack(side=Tix.TOP, fill=Tix.X)
     for bt in bts:
         bt.pack(side=Tix.LEFT, fill=Tix.X)
     self.tlist = tlist
     self.patlist = []
     self.notebook = notebook
コード例 #5
0
ファイル: tixwidgets.py プロジェクト: Geniuspp/python
def MkSText(w):
    """The TixScrolledWindow widget allows you to scroll any kind of Tk
    widget. It is more versatile than a scrolled canvas widget."""
    top = Tix.Frame(w, width=330, height=330)
    bot = Tix.Frame(w)
    msg = Tix.Message(top,
                      relief=Tix.FLAT, width=200, anchor=Tix.N,
                      text='The Tix ScrolledWindow widget allows you to scroll any kind of Tk widget. It is more versatile than a scrolled canvas widget.')

    win = Tix.ScrolledText(top, scrollbar='auto')
    win.text['wrap'] = 'none'
    win.text.insert(Tix.END, '''When -scrollbar is set to "auto", the
scrollbars are shown only when needed.
Additional modifiers can be used to force a
scrollbar to be shown or hidden. For example,
"auto -y" means the horizontal scrollbar
should be shown when needed but the vertical
scrollbar should always be hidden;
"auto +x" means the vertical scrollbar
should be shown when needed but the horizontal
scrollbar should always be shown, and so on.'''
)
    win.place(x=30, y=150, width=190, height=100)

    rh = Tix.ResizeHandle(top, bg='black',
                          relief=Tix.RAISED,
                          handlesize=8, gridded=1, minwidth=50, minheight=30)
    btn = Tix.Button(bot, text='Reset', command=lambda w=rh, x=win: SText_reset(w,x))
    top.propagate(0)
    msg.pack(fill=Tix.X)
    btn.pack(anchor=Tix.CENTER)
    top.pack(expand=1, fill=Tix.BOTH)
    bot.pack(fill=Tix.BOTH)
    win.bind('<Map>', func=lambda arg=0, rh=rh, win=win:
             win.tk.call('tixDoWhenIdle', str(rh), 'attachwidget', str(win)))
コード例 #6
0
def MkSWindow(w):
    """The ScrolledWindow widget allows you to scroll any kind of Tk
    widget. It is more versatile than a scrolled canvas widget.
    """
    global demo

    text = 'The Tix ScrolledWindow widget allows you to scroll any kind of Tk widget. It is more versatile than a scrolled canvas widget.'

    file = os.path.join(demo.dir, 'bitmaps', 'tix.gif')
    if not os.path.isfile(file):
        text += ' (Image missing)'

    top = Tix.Frame(w, width=330, height=330)
    bot = Tix.Frame(w)
    msg = Tix.Message(top, relief=Tix.FLAT, width=200, anchor=Tix.N, text=text)

    win = Tix.ScrolledWindow(top, scrollbar='auto')

    if 0:
        global image1
        # This image is not showing up in the Label unless it is set to a
        # global variable - no problem under Tcl/Tix. I assume it is being
        # garbage collected somehow, even though the Tcl command 'image names'
        # shows that as far as Tcl is concerned, the image exists and is
        # called pyimage1. What I find curious is that this if 0: branch
        # works only if image1 is global, *even though I give Label a string*.
        image1 = Tix.Image('photo', file=file)
    else:
        # No need for image1 to be global if I do it in pure Tcl.
        # When I do it in pure Tcl the image shows up in the Label.
        # The tcl command 'image names' shows as far as Tcl is concerned,
        # the image exists and is called image1. So I assume the problem
        # lies Tkinter.py Image.__init__, where the image gets the name
        # pyimage1, instead of what Tcl would have called it - image1.
        image1 = win.tk.eval('image create photo -file {%s}' % file)

    lbl = Tix.Label(win.window, image='%s' % image1)
    lbl.pack(expand=1, fill=Tix.BOTH)

    win.place(x=30, y=150, width=190, height=120)

    rh = Tix.ResizeHandle(top,
                          bg='black',
                          relief=Tix.RAISED,
                          handlesize=8,
                          gridded=1,
                          minwidth=50,
                          minheight=30)
    btn = Tix.Button(bot,
                     text='Reset',
                     command=lambda w=rh, x=win: SWindow_reset(w, x))
    top.propagate(0)
    msg.pack(fill=Tix.X)
    btn.pack(anchor=Tix.CENTER)
    top.pack(expand=1, fill=Tix.BOTH)
    bot.pack(fill=Tix.BOTH)
    win.bind('<Map>',
             func=lambda arg=0, rh=rh, win=win: win.tk.call(
                 'tixDoWhenIdle', str(rh), 'attachwidget', str(win)))
コード例 #7
0
 def __init__(self, parent, name, unit, lower, upper, goal, actual):
     Tix.Frame.__init__(self, parent)
     self.unit_scale = 1
     if unit == 'rad' or unit == 'radians':
         unit = 'deg'
         self.unit_scale = math.pi / 180
     elif unit == 'm' or unit == 'meters':
         unit = 'mm'
         self.unit_scale = 0.001
     lower /= self.unit_scale
     upper /= self.unit_scale
     goal /= self.unit_scale
     actual /= self.unit_scale
     Tix.Label(self, text = '%s [%s]  (%5.2f to %5.2f)' % (name, unit, lower, upper), anchor = 'w')\
         .pack(side = Tix.TOP, expand = True, fill = Tix.X)
     self.goal_var = Tix.DoubleVar(self)
     self.goal_var.set(goal)
     frame = Tix.Frame(self)
     Tix.Label(frame, text='goal', width=6).pack(side=Tix.LEFT)
     self.goal_scale = Tix.Scale(frame,
                                 orient=Tix.HORIZONTAL,
                                 variable=self.goal_var,
                                 showvalue=0,
                                 from_=lower,
                                 to=upper,
                                 command=self._UpdateGoalLabel)
     self.goal_scale.pack(side=Tix.LEFT, expand=True, fill=Tix.X)
     self.FORMAT = '%5.2f'
     self.goal_label = Tix.Label(frame, text=self.FORMAT % goal, width=12)
     self.goal_label.pack(side=Tix.LEFT)
     frame.pack(side=Tix.TOP, expand=True, fill=Tix.X)
     self.actual_var = Tix.DoubleVar(self)
     self.actual_var.set(actual)
     frame = Tix.Frame(self)
     Tix.Label(self, text='actual', width=6).pack(side=Tix.LEFT)
     self.actual_scale = Tix.Scale(self,
                                   orient=Tix.HORIZONTAL,
                                   state=Tix.DISABLED,
                                   sliderrelief=Tix.FLAT,
                                   sliderlength=3,
                                   variable=self.actual_var,
                                   showvalue=0,
                                   from_=lower,
                                   to=upper,
                                   command=self._UpdateGoalLabel)
     self.actual_scale.pack(side=Tix.LEFT, expand=True, fill=Tix.X)
     self.actual_label = Tix.Label(frame,
                                   text=self.FORMAT % actual,
                                   width=12)
     self.actual_label.pack(side=Tix.LEFT)
     frame.pack(side=Tix.TOP, expand=True, fill=Tix.X)
     self.lower = lower
     self.upper = upper
     self.master_var = None
コード例 #8
0
def MkNoteBook(w):
    msg = Tix.Message(
        w,
        relief=Tix.FLAT,
        width=240,
        anchor=Tix.N,
        text=
        'The NoteBook widget allows you to layout a complex interface into individual pages.'
    )
    prefix = Tix.OptionName(w)
    if not prefix:
        prefix = ''
    w.option_add('*' + prefix + '*TixControl*entry.width', 10)
    w.option_add('*' + prefix + '*TixControl*label.width', 18)
    w.option_add('*' + prefix + '*TixControl*label.anchor', Tix.E)
    w.option_add('*' + prefix + '*TixNoteBook*tagPadX', 8)

    nb = Tix.NoteBook(w, ipadx=6, ipady=6)
    nb.add('hard_disk', label="Hard Disk", underline=0)
    nb.add('network', label="Network", underline=0)

    # Frame for the buttons that are present on all pages
    common = Tix.Frame(nb.hard_disk)
    common.pack(side=Tix.RIGHT, padx=2, pady=2, fill=Tix.Y)
    CreateCommonButtons(common)

    # Widgets belonging only to this page
    a = Tix.Control(nb.hard_disk, value=12, label='Access Time: ')
    w = Tix.Control(nb.hard_disk, value=400, label='Write Throughput: ')
    r = Tix.Control(nb.hard_disk, value=400, label='Read Throughput: ')
    c = Tix.Control(nb.hard_disk, value=1021, label='Capacity: ')
    a.pack(side=Tix.TOP, padx=20, pady=2)
    w.pack(side=Tix.TOP, padx=20, pady=2)
    r.pack(side=Tix.TOP, padx=20, pady=2)
    c.pack(side=Tix.TOP, padx=20, pady=2)

    common = Tix.Frame(nb.network)
    common.pack(side=Tix.RIGHT, padx=2, pady=2, fill=Tix.Y)
    CreateCommonButtons(common)

    a = Tix.Control(nb.network, value=12, label='Access Time: ')
    w = Tix.Control(nb.network, value=400, label='Write Throughput: ')
    r = Tix.Control(nb.network, value=400, label='Read Throughput: ')
    c = Tix.Control(nb.network, value=1021, label='Capacity: ')
    u = Tix.Control(nb.network, value=10, label='Users: ')
    a.pack(side=Tix.TOP, padx=20, pady=2)
    w.pack(side=Tix.TOP, padx=20, pady=2)
    r.pack(side=Tix.TOP, padx=20, pady=2)
    c.pack(side=Tix.TOP, padx=20, pady=2)
    u.pack(side=Tix.TOP, padx=20, pady=2)

    msg.pack(side=Tix.TOP, padx=3, pady=3, fill=Tix.BOTH)
    nb.pack(side=Tix.TOP, padx=5, pady=5, fill=Tix.BOTH, expand=1)
コード例 #9
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)
コード例 #10
0
    def __init__(self, master, tag, title, args):
        VisionStruct.__init__(
            self,
            master,
            tag,
            varname=title,
            args=args,
        )
        self.counter0 = 0
        self.counter1 = 0

        self.single_frame = Tix.Frame(self.value)
        self.single_frame.grid(row=0, column=0, sticky="we")
        self.pole_frame = Tix.Frame(self.value)
        self.pole_frame.grid(row=1, column=0, sticky="we")
コード例 #11
0
def Runtree(w, filename):
    top = tkinter_tix.Frame(w, relief=tkinter_tix.RAISED, bd=1)
    tree = tkinter_tix.Tree(top, options="hlist.columns 2")
    tree.pack(expand=1,
              fill=tkinter_tix.BOTH,
              padx=10,
              pady=10,
              side=tkinter_tix.LEFT)
    tree.hlist.configure(bg='white', font='Courier 10', indent=30)
    tree.hlist.configure(selectbackground='light yellow', gap=150)

    box = tkinter_tix.ButtonBox(w, orientation=tkinter_tix.HORIZONTAL)
    box.add('ok', text='OK', underline=0, command=w.destroy, width=6)
    box.add('exit', text='Exit', underline=0, command=w.destroy, width=6)
    box.pack(side=tkinter_tix.BOTTOM, fill=tkinter_tix.X)
    top.pack(side=tkinter_tix.TOP, fill=tkinter_tix.BOTH, expand=1)

    tree.bind_all(
        '<MouseWheel>', lambda event: tree.hlist.yview_scroll(
            int(-1 * event.delta / 120.), "units"))
    tree.bind_all('<Button-4>',
                  lambda event: tree.hlist.yview_scroll(int(-1), "units"))
    tree.bind_all('<Button-5>',
                  lambda event: tree.hlist.yview_scroll(int(+1), "units"))
    show_file(filename, tree)
コード例 #12
0
def MkToolBar(w):
    global demo

    prefix = Tix.OptionName(w)
    if not prefix: prefix = ''
    w.option_add('*' + prefix + '*TixSelect*frame.borderWidth', 1)
    msg = Tix.Message(w, font='-*-helvetica-bold-r-normal-*-14-*-*-*-*-*-*-*',
		      relief=Tix.FLAT, width=240, anchor=Tix.N,
		      text='The Select widget is also good for arranging buttons in a tool bar.')
    bar = Tix.Frame(w, bd=2, relief=Tix.RAISED)
    font = Tix.Select(w, allowzero=1, radio=0, label='')
    para = Tix.Select(w, allowzero=0, radio=1, label='')

    font.add('bold', bitmap='@' + demo.dir + '/bitmaps/bold.xbm')
    font.add('italic', bitmap='@' + demo.dir + '/bitmaps/italic.xbm')
    font.add('underline', bitmap='@' + demo.dir + '/bitmaps/underline.xbm')
    font.add('capital', bitmap='@' + demo.dir + '/bitmaps/capital.xbm')

    para.add('left', bitmap='@' + demo.dir + '/bitmaps/leftj.xbm')
    para.add('right', bitmap='@' + demo.dir + '/bitmaps/rightj.xbm')
    para.add('center', bitmap='@' + demo.dir + '/bitmaps/centerj.xbm')
    para.add('justify', bitmap='@' + demo.dir + '/bitmaps/justify.xbm')

    msg.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=3, pady=3)
    bar.pack(side=Tix.TOP, fill=Tix.X, padx=3, pady=3)
    font.pack({'in':bar}, side=Tix.LEFT, padx=3, pady=3)
    para.pack({'in':bar}, side=Tix.LEFT, padx=3, pady=3)
コード例 #13
0
 def __init__(self, parent, name, unit, lower, upper, value):
     Tix.Frame.__init__(self, parent)
     self.unit_scale = 1
     if unit == 'rad' or unit == 'radians':
         unit = 'deg'
         self.unit_scale = math.pi / 180
     elif unit == 'm' or unit == 'meters':
         unit = 'mm'
         self.unit_scale = 0.001
     lower /= self.unit_scale
     upper /= self.unit_scale
     value /= self.unit_scale
     Tix.Label(self, text = '%s [%s]  (%5.2f to %5.2f)' % (name, unit, lower, upper), anchor = 'w')\
         .pack(side = Tix.TOP, expand = True, fill = Tix.X)
     self.value_var = Tix.DoubleVar(self)
     self.value_var.set(value)
     frame = Tix.Frame(self)
     Tix.Label(frame, text='value', width=6).pack(side=Tix.LEFT)
     self.value_scale = Tix.Scale(frame,
                                  orient=Tix.HORIZONTAL,
                                  variable=self.value_var,
                                  showvalue=0,
                                  from_=lower,
                                  to=upper,
                                  command=self._UpdateValueLabel)
     self.value_scale.pack(side=Tix.LEFT, expand=True, fill=Tix.X)
     self.FORMAT = '%5.2f'
     self.value_label = Tix.Label(frame, text=self.FORMAT % value, width=12)
     self.value_label.pack(side=Tix.LEFT)
     frame.pack(side=Tix.TOP, expand=True, fill=Tix.X)
     self.lower = lower
     self.upper = upper
     self.master_var = None
コード例 #14
0
ファイル: ui_tk.py プロジェクト: Armel35/pyglossary
  def about_clicked(self):
    about = Tix.Toplevel(width=600)## bg='#0f0' does not work
    about.title('About PyGlossary')
    about.resizable(False, False)
    about.wm_iconbitmap('@%s%spyglossary.xbm'%(srcDir,os.sep))
    ###
    msg1=Tix.Message(about, width=350, text='PyGlossary %s (Tkinter)'%VERSION,\
      font=('DejaVu Sans', 13, 'bold'))
    msg1.pack(fill='x', expand=True)
    ###
    msg2 = Tix.Message(about, width=350, text=\
'''A tool for workig with dictionary databases
Copyleft © 2008-2009 Saeed Rasooli
PyGlossary is licensed by the GNU General Public License version 3 (or later)''',\
      font=('DejaVu Sans', 9, 'bold'), justify=Tix.CENTER)
    msg2.pack(fill='x', expand=True)
    ###
    msg3=Tix.Message(about, width=350, text=homePage,\
      font=('DejaVu Sans', 8, 'bold'), fg='#3333ff')
    msg3.pack(fill='x', expand=True)
    ###
    msg4=Tix.Message(about, width=350,
      text='Install PyGTK to have a better interface!',\
      font=('DejaVu Sans', 8, 'bold'), fg='#00aa00')
    msg4.pack(fill='x', expand=True)
    ###########
    frame = Tix.Frame(about)
    closeB = Tix.Button(frame, text='Close', command=about.destroy,
                        bg='#ff0000', activebackground='#ff5050')
    closeB.pack(side='right')
    licenseB = Tix.Button(frame, text='License', 
                          command=self.about_license_clicked,
                          bg='#f0f000', activebackground='#f6f622')
    licenseB.pack(side='right')
    frame.pack(fill='x')
コード例 #15
0
ファイル: tixwidgets.py プロジェクト: Oize/pspstacklesspython
def MkToolBar(w):
    """The Select widget is also good for arranging buttons in a tool bar.
    """
    global demo

    options = 'frame.borderWidth 1'

    msg = Tix.Message(
        w,
        relief=Tix.FLAT,
        width=240,
        anchor=Tix.N,
        text=
        'The Select widget is also good for arranging buttons in a tool bar.')
    bar = Tix.Frame(w, bd=2, relief=Tix.RAISED)
    font = Tix.Select(w, allowzero=1, radio=0, label='', options=options)
    para = Tix.Select(w, allowzero=0, radio=1, label='', options=options)

    font.add('bold', bitmap='@' + demo.dir + '/bitmaps/bold.xbm')
    font.add('italic', bitmap='@' + demo.dir + '/bitmaps/italic.xbm')
    font.add('underline', bitmap='@' + demo.dir + '/bitmaps/underline.xbm')
    font.add('capital', bitmap='@' + demo.dir + '/bitmaps/capital.xbm')

    para.add('left', bitmap='@' + demo.dir + '/bitmaps/leftj.xbm')
    para.add('right', bitmap='@' + demo.dir + '/bitmaps/rightj.xbm')
    para.add('center', bitmap='@' + demo.dir + '/bitmaps/centerj.xbm')
    para.add('justify', bitmap='@' + demo.dir + '/bitmaps/justify.xbm')

    msg.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=3, pady=3)
    bar.pack(side=Tix.TOP, fill=Tix.X, padx=3, pady=3)
    font.pack({'in': bar}, side=Tix.LEFT, padx=3, pady=3)
    para.pack({'in': bar}, side=Tix.LEFT, padx=3, pady=3)
コード例 #16
0
ファイル: TkTime.py プロジェクト: drewp/eventually
    def __init__(self, master):
        Tk.Frame.__init__(self, master)
        self.tktime = TkTime(self,
                             bg='black',
                             fg='white',
                             insertbackground='white',
                             parsed_color='blue',
                             special_symbols=[NotPresent])
        self.tktime.pack(side='top', fill='both', expand=1)

        contextframe = Tk.Frame(self)
        contexttext = Tk.Label(contextframe, text='Context')
        contexttext.pack(side='left', ipadx=0, ipady=0, padx=0, pady=0)
        self.context = TkTime(contextframe)
        dispatcher.connect(self.context_selector,
                           "selection made",
                           sender=self.context)
        dispatcher.connect(self.context_has_parses,
                           "new segment parses",
                           sender=self.context)
        self.context['height'] = 23  # errr...
        self.context.pack(side='left', fill='x', expand=0)
        self.contextlabel = Tk.Label(contextframe)
        self.contextlabel.pack(side='left',
                               ipadx=0,
                               ipady=0,
                               padx=0,
                               pady=0,
                               expand=1)
        contextframe.pack(side='top', fill='both', expand=0)

        self.context.text.bind("<KeyRelease>", self.typed_in_context, '+')
コード例 #17
0
    def MkMainMenu(self):
        top = self.root
        w = Tix.Frame(top, bd=2, relief=RAISED)
        file = Tix.Menubutton(w, text='File', underline=0, takefocus=0)
        help = Tix.Menubutton(w, text='Help', underline=0, takefocus=0)
        file.pack(side=LEFT)
        help.pack(side=RIGHT)
        fm = Tix.Menu(file, tearoff=0)
        file['menu'] = fm
        hm = Tix.Menu(help, tearoff=0)
        help['menu'] = hm

        if w.tk.eval('info commands console') == "console":
            fm.add_command(label='Console',
                           underline=1,
                           command=lambda w=w: w.tk.eval('console show'))

        fm.add_command(label='Exit',
                       underline=1,
                       command=lambda self=self: self.quitcmd())
        hm.add_checkbutton(label='BalloonHelp',
                           underline=0,
                           command=self.ToggleHelp,
                           variable=self.useBalloons)
        # The trace variable option doesn't seem to work, instead I use 'command'
        #apply(w.tk.call, ('trace', 'variable', self.useBalloons, 'w',
        #             ToggleHelp))
        return w
コード例 #18
0
ファイル: pman.py プロジェクト: Fyedka/mage
 def __init__(self, master=None):
     self.mandirs = ManDirectories()
     self.frame = Tix.Frame(master)
     self.section = Tix.StringVar()
     combo = Tix.ComboBox(self.frame,
                          label='Section: ',
                          dropdown=1,
                          editable=0,
                          variable=self.section,
                          command=self.UpdatePageList)
     pagelist = Tix.ScrolledListBox(self.frame, scrollbar='auto')
     self.listbox = pagelist.listbox
     self.listbox.bind('<Double-1>', self.ShowPage)
     temp = self.mandirs.section_names.keys()
     temp.sort()
     for s in temp:
         combo.insert(Tix.END, s)
     box = Tix.ButtonBox(self.frame, orientation=Tix.HORIZONTAL)
     box.add('show',
             text='Show Page ...',
             underline=0,
             width=13,
             command=self.ShowPage)
     box.add('aprop',
             text='Apropos ...',
             underline=0,
             width=13,
             command=self.Apropos)
     box.add('quit', text='Quit', underline=0, width=13, command=self.Quit)
     combo.pack(side=Tix.TOP, expand=0, fill=Tix.X)
     pagelist.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH)
     box.pack(side=Tix.BOTTOM, expand=0, fill=Tix.X)
     self.frame.pack(expand=1, fill=Tix.BOTH)
コード例 #19
0
ファイル: panel.py プロジェクト: szehl/wifi-arsenal
 def __init__(self,toplevel,chief,title,iconpath=None):
     SlavePanel.__init__(self,toplevel,chief,iconpath)
     self.master.title(title)
     self.pack(expand=True,fill=Tix.BOTH,side=Tix.TOP)
     frm = Tix.Frame(self)
     frm.pack(side=Tix.TOP,fill=Tix.BOTH,expand=True)
     self._body(frm)
コード例 #20
0
def MkMainStatus(top):
    global demo

    w = Tix.Frame(top, relief=Tix.RAISED, bd=1)
    demo.statusbar = Tix.Label(w, relief=Tix.SUNKEN, bd=1, font='-*-helvetica-medium-r-normal-*-14-*-*-*-*-*-*-*')
    demo.statusbar.form(padx=3, pady=3, left=0, right='%70')
    return w
コード例 #21
0
def RunTree(w, filename):
    top = tkinter_tix.Frame(w, relief=tkinter_tix.RAISED, bd=1)
    tree = tkinter_tix.Tree(top, options="hlist.columns 2")
    tree.pack(expand=1,
              fill=tkinter_tix.BOTH,
              padx=10,
              pady=10,
              side=tkinter_tix.LEFT)
    # print(tree.hlist.keys())   # use to see the available configure() options
    tree.hlist.configure(bg='white', font='Courier 10', indent=30)
    tree.hlist.configure(selectbackground='light yellow', gap=150)

    box = tkinter_tix.ButtonBox(w, orientation=tkinter_tix.HORIZONTAL)
    # box.add('ok', text='Ok', underline=0, command=w.destroy, width=6)
    box.add('exit', text='Exit', underline=0, command=w.destroy, width=6)
    box.pack(side=tkinter_tix.BOTTOM, fill=tkinter_tix.X)
    top.pack(side=tkinter_tix.TOP, fill=tkinter_tix.BOTH, expand=1)
    # https://stackoverflow.com/questions/17355902/python-tkinter-binding-mousewheel-to-scrollbar
    tree.bind_all(
        '<MouseWheel>',
        lambda event:  # Wheel in Windows
        tree.hlist.yview_scroll(int(-1 * event.delta / 120.), "units"))
    tree.bind_all(
        '<Button-4>',
        lambda event:  # Wheel up in Linux
        tree.hlist.yview_scroll(int(-1), "units"))
    tree.bind_all(
        '<Button-5>',
        lambda event:  # Wheel down in Linux
        tree.hlist.yview_scroll(int(+1), "units"))

    show_file(filename, tree)
コード例 #22
0
 def _build_calendar(self):
     # Create frame and widgets.
     # Add header.
     hframe = TKx.Frame(self)
     hframe.pack(fill='x', expand=1)
     self.month_str = TKx.StringVar()
     lbtn = TKx.Button(hframe, text=u'\u25b2', command=self._prev_month)
     rbtn = TKx.Button(hframe, text=u'\u25bc', command=self._next_month)
     lbtn.pack(side='left')
     rbtn.pack(side='right')
     tl = TKx.Label(hframe, textvariable=self.month_str)
     tl.pack(side='top')
     self.top_label = tl
     self._set_month_str()
     self.days_frame = TKx.Frame(self)
     self.days_frame.pack(fill='x', expand=1)
コード例 #23
0
 def __init__(self, parent, prefixes, name, maxvals, gains):
     if (len(prefixes) != len(maxvals)) or (len(prefixes) != len(gains)):
         raise 'you gave me %d prefixes, %d maxvals, and %d gains' % (
             len(prefixes), len(maxvals), len(gains))
     Tix.Frame.__init__(self, parent)
     self.name = Tix.Label(self, text='name: %s' % name, anchor='w')
     self.name.pack(side=Tix.TOP, expand=True, fill=Tix.X)
     self.gain_var = []
     self.gain_label = []
     self.gain_scale = []
     self.master_var = []
     for ii in xrange(len(prefixes)):
         gv = Tix.DoubleVar(self)
         gv.set(gains[ii])
         frame = Tix.Frame(self)
         Tix.Label(frame, text=prefixes[ii], width=6).pack(side=Tix.LEFT)
         gs = Tix.Scale(frame,
                        orient=Tix.HORIZONTAL,
                        variable=gv,
                        showvalue=0,
                        from_=0,
                        to=maxvals[ii])
         gs.pack(side=Tix.LEFT, expand=True, fill=Tix.X)
         gl = Tix.Label(frame, textvariable=gv, width=12)
         gl.pack(side=Tix.LEFT)
         frame.pack(side=Tix.TOP, expand=True, fill=Tix.X)
         self.gain_var.append(gv)
         self.gain_label.append(gl)
         self.gain_scale.append(gs)
         self.master_var.append(None)
コード例 #24
0
ファイル: gui.py プロジェクト: kanehekili/JVCModcopy
    def build(self):
        # control variables
        self.copy_file = Tk.StringVar()

        # frame 0
        self.fr0 = Tix.Frame(self.toplevel)
        self.bu9 = Tix.Button(
            self.fr0,
            text="Cancel",
            command=self.cancel,
        )
        self.bu9.pack(padx=5, pady=5)

        # frame 4
        self.lf4 = Tk.LabelFrame(
            self.toplevel,
            text="Copy progress",
        )
        self.la4 = Tk.Label(self.lf4,
                            width=40,
                            anchor="w",
                            textvariable=self.copy_file)
        self.me4 = Tix.Meter(self.lf4, value=0.0)
        self.la4.pack(padx=5, pady=5)
        self.me4.pack(padx=5, pady=5)

        # pack frames
        self.lf4.pack(padx=5, pady=5)
        self.fr0.pack(side="bottom")
コード例 #25
0
    def view_info(self):
        top = self.skyeye_body("System information")

        tmp = Tix.Frame(top, padx=10, pady=15)

        b = Tix.Message(tmp,
                        relief=Tix.FLAT,
                        width=240,
                        anchor=Tix.N,
                        text='Below are the information of the whole system:')
        b.grid(row=0, padx=5, pady=3, sticky=W + E)

        str = ""

        str += "Cpu \t\t: %s\n" % self.cpu
        str += "Mainboard \t: %s\n" % self.board
        str += "Net \t\t: %s\n" % self.net
        str += "Lcd \t\t: %s\n" % self.lcd
        str += "Flash \t\t: %s\n" % self.flash

        for x in self.membank:
            str += "membank \t : "

            str += "map=" + x["map"] + ","
            str += "type=" + x["type"] + ","
            str += "addr=" + x["addr"] + ","
            str += "size=" + x["size"]

            if x["file"] != "":
                str += ",file=" + x["file"]
            str += "\n"

        b = Tix.Message(tmp,
                        relief=Tix.FLAT,
                        width=440,
                        anchor=Tix.N,
                        text='%s' % str)
        b.grid(row=1, padx=5, pady=3, sticky=W + E)

        b = Tix.Message(tmp,
                        relief=Tix.FLAT,
                        width=240,
                        anchor=Tix.N,
                        text='Would you want to reset ALL?')
        b.grid(row=2, padx=5, pady=3, sticky=W + E)

        reset = Tix.Button(tmp,
                           text="OK",
                           command=self.reset_all,
                           width=5,
                           bg="red",
                           fg="white")
        reset.grid(row=3, padx=5, pady=3)

        tmp.grid(padx=5, pady=25)

        self.message("System information is :\n" + str)

        self.skyeye_redobody()
コード例 #26
0
ファイル: DirTree.py プロジェクト: tanyancai/jim-psp
    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)
コード例 #27
0
    def MkMainStatus(self):
        global test
        top = self.root

        w = Tix.Frame(top, relief=Tix.RAISED, bd=1)
        test.statusbar = Tix.Label(w, relief=Tix.SUNKEN, bd=1)
        test.statusbar.form(padx=3, pady=3, left=0, right='%70')
        return w
コード例 #28
0
    def net_lcd_flash_ok(self, event=None):
        self.device_once = 1
        top = self.skyeye_body("Peripherial")

        tmp = Tix.Frame(top)

        b = Tix.Message(tmp,
                        relief=Tix.FLAT,
                        width=240,
                        anchor=Tix.N,
                        text='Below are the information of peripherials:')
        b.grid(row=0, padx=5, pady=3, sticky=W + E)

        self.net = self.net_v.get()[2:-3]
        str = ""
        if self.net != "":
            str += "\tNet\t: %s\n" % self.net
        else:
            str += "\tNet\t: disabled\n"

        self.lcd = self.lcd_v.get()[2:-3]
        if self.lcd != "":
            str += "\tLcd\t: %s\n" % self.lcd
        else:
            str += "\tLcd\t: disabled\n"

        self.flash = self.flash_v.get()[2:-3]
        if self.flash != "":
            str += "\tFlash\t: %s\n" % self.flash
        else:
            str += "\tFlash\t: disabled\n"

        b = Tix.Message(tmp,
                        relief=Tix.FLAT,
                        width=240,
                        anchor=Tix.N,
                        text='%s' % str)
        b.grid(row=1, padx=5, pady=3, sticky=W + E)

        b = Tix.Message(tmp,
                        relief=Tix.FLAT,
                        width=240,
                        anchor=Tix.N,
                        text='Would you want to reset?')
        b.grid(row=2, padx=5, pady=3, sticky=W + E)

        reset = Tix.Button(tmp,
                           text="OK",
                           command=self.reset_device,
                           width=5,
                           bg="red",
                           fg="white")
        reset.grid(row=3, padx=5, pady=3)

        tmp.grid(padx=5, pady=10)

        self.message("Peripherial information:\n" + str)
        self.skyeye_redobody()
コード例 #29
0
    def __init__(self, master):
        # control panel
        conf = tix.Frame(master, bg="lightblue", width=300, padx=1, pady=1)
        conf.grid(row=0, column=0, sticky="nw")
        conf.pack(fill="both", expand=1, side="left")

        # file list window
        self.files = tix.FileSelectBox(conf,
                                       bg='white',
                                       width=300,
                                       height=760,
                                       command=self.dispfile)
        self.files.grid(row=1, column=1, sticky="nw")
        self.files.pack(fill='both', expand=1, side="bottom")

        # text window
        textw = tix.Frame(master,
                          bg="lightblue",
                          width=900,
                          height=960,
                          padx=5,
                          pady=1)
        textw.grid(row=0, column=1, columnspan=2, sticky="ne")
        textw.pack(fill='both', expand=1, side="right")

        self.edit = tix.ScrolledText(textw,
                                     bg='lightblue',
                                     width=900,
                                     height=960)
        self.edit.pack()

        # Menu
        menu = tix.Menu(master)
        root.config(menu=menu)
        # file menu
        filemenu = tix.Menu(menu, tearoff=0)
        menu.add_cascade(label="File", menu=filemenu)
        filemenu.add_command(label="New", command=self.new_text)
        filemenu.add_command(label="Open", command=self.file_open)
        filemenu.add_command(label="SaveAs", command=self.file_saveas)
        filemenu.add_separator()
        filemenu.add_command(label="Exit", command=self.do_exit)

        # start with cursor in the editor area
        self.edit.focus()
コード例 #30
0
ファイル: panel.py プロジェクト: szehl/wifi-arsenal
    def __init__(self,toplevel,chief,ttl,sz,cols=1,httl=None,iconPath=None):
        SlavePanel.__init__(self,toplevel,chief,iconPath)
        self.master.title(ttl)
        self.pack(expand=True,fill=Tix.BOTH,side=Tix.TOP)

        # create and allow derived classes to setup top frame
        frmTop = Tix.Frame(self)
        if self.topframe(frmTop): frmTop.pack(side=Tix.TOP,expand=False)

        # need hdr value for HList init
        hdr = True
        if not httl: hdr = False

        # setup the hlist
        self.frmMain = Tix.Frame(self)
        self.frmMain.pack(side=Tix.TOP,fill=Tix.BOTH,expand=True)

        # create the scrolled hlist
        # NOTE: if necessary, should be able to use Tree as below
        # self.slist = Tree(self.frmMain,options='hlist.columns %d hlist.header %d' % (cols,hdr))
        self.slist = Tix.ScrolledHList(self.frmMain,
                                       options='hlist.columns %d hlist.header %d' % (cols,hdr))

        # configure the hlist
        self.list = self.slist.hlist                       # get the hlist
        if sz: self.list.config(width=sz[0],height=sz[1])  # set the width/height
        self.list.config(selectforeground='black')         # set to black or it dissappears
        self.list.config(selectmode='extended')            # allow multiple selects
        self.list.config(separator='\t')                   # use tab ignoring special chars

        style = {}
        style['header'] = Tix.DisplayStyle(Tix.TEXT,
                                           refwindow=self.list,
                                           anchor=Tix.CENTER)
        for i in range(len(httl)):
            self.list.header_create(i,itemtype=Tix.TEXT,text=httl[i],
                                      style=style['header'])

        # and pack the scrolled list
        self.slist.pack(expand=True,fill=Tix.BOTH,side=Tix.LEFT)

        # allow a bottom frame
        frmBottom = Tix.Frame(self)
        if self.bottomframe(frmBottom):
            frmBottom.pack(side=Tix.TOP,expand=False)