Beispiel #1
0
  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')
Beispiel #2
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()
Beispiel #3
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()
Beispiel #4
0
    def memory_ok(self, event=None):
        self.memory_once = 1

        top = self.skyeye_body("Memory")

        tmp = Tix.Frame(top)

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

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

            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?')
        b.grid(row=2, padx=5, pady=3, sticky=W + E)

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

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

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

        self.skyeye_redobody()
Beispiel #5
0
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)))
Beispiel #6
0
def MkFileEnt(w):
    msg = Tix.Message(w,
                      relief=Tix.FLAT, width=240, anchor=Tix.N,
                      text='Press the "open file" icon button and a TixFileSelectDialog will popup.')
    ent = Tix.FileEntry(w, label='Select a file : ')
    msg.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=3, pady=3)
    ent.pack(side=Tix.TOP, fill=Tix.X, padx=3, pady=3)
Beispiel #7
0
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)
Beispiel #8
0
def MkDirListWidget(w):
    msg = Tix.Message(w, font='-*-helvetica-bold-r-normal-*-14-*-*-*-*-*-*-*',
		      relief=Tix.FLAT, width=240, anchor=Tix.N,
		      text='The TixDirList widget gives a graphical representation of the file system directory and makes it easy for the user to choose and access directories.')
    dirlist = Tix.DirList(w, options='hlist.padY 1 hlist.width 25 hlist.height 16')
    msg.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=3, pady=3)
    dirlist.pack(side=Tix.TOP, padx=3, pady=3)
Beispiel #9
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)))
Beispiel #10
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)
Beispiel #11
0
def MkFileBox(w):
    msg = Tix.Message(w, font='-*-helvetica-bold-r-normal-*-14-*-*-*-*-*-*-*',
		      relief=Tix.FLAT, width=240, anchor=Tix.N,
		      text='The TixFileSelectBox is a Motif-style box with various enhancements. For example, you can adjust the size of the two listboxes and your past selections are recorded.')
    box = Tix.FileSelectBox(w)
    msg.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=3, pady=3)
    box.pack(side=Tix.TOP, fill=Tix.X, padx=3, pady=3)
Beispiel #12
0
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)))
Beispiel #13
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)))
Beispiel #14
0
def MkExFileWidget(w):
    msg = Tix.Message(w, font='-*-helvetica-bold-r-normal-*-14-*-*-*-*-*-*-*',
		      relief=Tix.FLAT, width=240, anchor=Tix.N,
		      text='The TixExFileSelectBox widget is more user friendly than the Motif style FileSelectBox.')
    # There's a bug in the ComboBoxes - the scrolledlistbox is destroyed
    box = Tix.ExFileSelectBox(w, bd=2, relief=Tix.RAISED)
    msg.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=3, pady=3)
    box.pack(side=Tix.TOP, padx=3, pady=3)
Beispiel #15
0
def MkTitle(w):
    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='There are many types of "chooser" widgets that allow the user to input different types of information')
    msg.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=3, pady=3)
Beispiel #16
0
def MkTitle(w):
    msg = Tix.Message(
        w,
        relief=Tix.FLAT,
        width=240,
        anchor=Tix.N,
        text=
        'There are many types of "chooser" widgets that allow the user to input different types of information'
    )
    msg.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=3, pady=3)
Beispiel #17
0
    def cpu_board_ok(self, event=None):
        self.cpu_once = 1
        top = self.skyeye_body("Cpu & Mainboard")

        tmp = Tix.Frame(top)

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

        b = Tix.Message(tmp,
                        relief=Tix.FLAT,
                        width=240,
                        anchor=Tix.N,
                        text='\tCpu\t\t: %s\n\tMainboard\t: %s' %
                        (self.cpu, self.board))
        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_cpu,
                           width=5,
                           bg="red",
                           fg="white")
        reset.grid(row=3, padx=5, pady=3)

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

        self.message("You choose:\n\tCpu\t\t: %s\n\tMainboard\t: %s" %
                     (self.cpu, self.board))

        self.skyeye_redobody()
Beispiel #18
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)
Beispiel #19
0
def MkPanedWindow(w):
    msg = Tix.Message(w, font='-*-helvetica-bold-r-normal-*-14-*-*-*-*-*-*-*',
		      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.Label(w, text='Newsgroup: 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: TK is good for your health")
    list.listbox.insert(Tix.END, "+ 12325 Re: TK is good for your health")
    list.listbox.insert(Tix.END, "+ 12326 Re: Tix is even better for your health (Was: TK is good...)")
    list.listbox.insert(Tix.END, "  12327 Re: Tix is even better for your health (Was: TK is good...)")
    list.listbox.insert(Tix.END, "+ 12328 Re: Tix is even better for your health (Was: TK is good...)")
    list.listbox.insert(Tix.END, "  12329 Re: Tix is even better for your health (Was: TK is good...)")
    list.listbox.insert(Tix.END, "+ 12330 Re: Tix is even better for your health (Was: TK 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.tcl              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. This way you can display very fancy stuffs
in your GUI. For example, you can display a text string string
together with a bitmap, at the same time, inside a TK button widget. A
screenshot of compound images can be found at the bottom of this page:

        http://www.cis.upenn.edu/~ioi/tix/screenshot.html

You can also you is in other places such as putting fancy bitmap+text
in menus, tabs of tixNoteBook widgets, etc. This feature will be
included in the next release of Tix (4.0b1). Count on it to make jazzy
interfaces!""")
    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)
Beispiel #20
0
 def about_license_clicked(self):
   about = Tix.Toplevel()## bg='#0f0' does not work
   about.title('PyGlossary License')
   about.resizable(False, False)
   about.wm_iconbitmap('@%s%spyglossary.xbm'%(srcDir,os.sep))
   ###
   msg1=Tix.Message(about, width=420, text=licenseText,
                    font=('DejaVu Sans', 9, 'bold'))
   msg1.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')
   frame.pack(fill='x')
Beispiel #21
0
def MkWelcomeText(top):
    global demo

    w = Tix.ScrolledWindow(top, scrollbar='auto')
    win = w.window
    title = Tix.Label(win, font='-*-times-bold-r-normal-*-18-*-*-*-*-*-*-*',
		      bd=0, width=30, anchor=Tix.N, text='Welcome to TIX Version 4.0 from Python Version 1.3')
    msg = Tix.Message(win, font='-*-helvetica-bold-r-normal-*-14-*-*-*-*-*-*-*',
		      bd=0, width=400, anchor=Tix.N,
		      text='Tix 4.0 is a set of mega-widgets based on TK. This program \
demonstrates the widgets in the Tix widget set. You can choose the pages \
in this window to look at the corresponding widgets. \n\n\
To quit this program, choose the "File | Exit" command.')
    title.pack(expand=1, fill=Tix.BOTH, padx=10, pady=10)
    msg.pack(expand=1, fill=Tix.BOTH, padx=10, pady=10)
    demo.welmsg = msg
    return w
Beispiel #22
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)
Beispiel #23
0
def MkWelcomeText(top):
    global demo

    w = Tix.ScrolledWindow(top, scrollbar='auto')
    win = w.window
    text = 'Welcome to TIX in Python'
    title = Tix.Label(win,
                      bd=0, width=30, anchor=Tix.N, text=text)
    msg = Tix.Message(win,
                      bd=0, width=400, anchor=Tix.N,
                      text='Tix is a set of mega-widgets based on TK. This program \
demonstrates the widgets in the Tix widget set. You can choose the pages \
in this window to look at the corresponding widgets. \n\n\
To quit this program, choose the "File | Exit" command.\n\n\
For more information, see http://tix.sourceforge.net.')
    title.pack(expand=1, fill=Tix.BOTH, padx=10, pady=10)
    msg.pack(expand=1, fill=Tix.BOTH, padx=10, pady=10)
    demo.welmsg = msg
    return w
Beispiel #24
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')

    image1 = win.window.image_create('photo', file=file)
    lbl = Tix.Label(win.window, image=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)))
Beispiel #25
0
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 TixScrolledWindow 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,
        'This is a text widget embedded in a scrolled window. Although the original Tix demo does not have any text here, I decided to put in some so that you can see the effect of scrollbars etc.'
    )
    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)))
Beispiel #26
0
 def about_credits_clicked(self):
     about = Tix.Toplevel()  ## bg='#0f0' does not work
     about.title('Credits')
     about.resizable(False, False)
     about.wm_iconbitmap('@%s' % xbmLogo)
     ###
     msg1 = Tix.Message(
         about,
         width=500,
         text='\n'.join(authors),
         font=('DejaVu Sans', 9, 'bold'),
     )
     msg1.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')
     frame.pack(fill='x')
Beispiel #27
0
# -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
Beispiel #28
0
    def project_save(self):
        if self.cpu_once == 0:
            self.message("Cpu and Mainboard is not chosen yet")
            self.welcome()
            return
        if self.device_once == 0:
            self.message("Peripherial is not chosen yet")
            self.welcome()
            return
        if self.memory_once == 0:
            self.message("Memory is not chose yet")
            self.welcome()
            return

        try:
            tmp_fd = open("skyeye.conf.koo", "w")

        except:
            self.message("./skyeye.conf.koo write failure")
            return

        top = self.skyeye_body("Write configuration file")

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

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

        str = "cpu\t:" + self.cpu + "\n"
        str += "mach\t:" + self.board + "\n"

        for x in self.membank:
            tmpp = "membank\t:map=" + x["map"] + ",type=" + x[
                "type"] + ",addr=" + x["addr"] + ",size=" + x["size"]
            if x["file"] != "":
                tmpp += ",file=" + x["file"]
            str += tmpp + "\n"

        if self.lcd != "":
            str += "lcd\t:state=on,type=" + self.lcd + ",mode=gtk\n"

        if self.net != "":
            pass  # i have to find one demo ...

        str += "dbct\t:state=on\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)

        tmp_fd.write(str)

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

        self.message("Information has been written to ./skyeye.conf.koo")

        self.skyeye_redobody()
Beispiel #29
0
 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' % xbmLogo)
     ###
     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=aboutText,
         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)
     ###
     button = Tix.Button(
         frame,
         text='Close',
         command=about.destroy,
         bg='#ff0000',
         activebackground='#ff5050',
     )
     button.pack(side='right')
     ###
     button = Tix.Button(
         frame,
         text='License',
         command=self.about_license_clicked,
         bg='#00e000',
         activebackground='#22f022',
     )
     button.pack(side='right')
     ###
     button = Tix.Button(
         frame,
         text='Credits',
         command=self.about_credits_clicked,
         bg='#0000ff',
         activebackground='#5050ff',
     )
     button.pack(side='right')
     ###
     frame.pack(fill='x')
Beispiel #30
0
    def execute_run(self):
        top = self.skyeye_body("Start running skyeye")

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

        b = Tix.Message(tmp,
                        relief=Tix.FLAT,
                        width=240,
                        anchor=Tix.N,
                        text='Below are the command to skyeye:')
        b.grid(row=0, padx=5, pady=15, sticky=W + E)
        tmp.grid(row=0, column=0, padx=5, pady=15, sticky=W + E)

        tmp = Tix.Frame(top, padx=10, pady=15)
        b = Tix.Message(tmp,
                        relief=Tix.FLAT,
                        width=440,
                        anchor=Tix.N,
                        text='skyeye')
        b.grid(row=0, column=0, padx=5, pady=3, sticky=W + E)
        b = Tix.Message(tmp,
                        relief=Tix.FLAT,
                        width=440,
                        anchor=Tix.N,
                        text='-e')
        b.grid(row=0, column=1, padx=5, pady=3, sticky=W + E)
        b = Tix.Message(tmp,
                        relief=Tix.FLAT,
                        width=440,
                        anchor=Tix.N,
                        text='-c')
        b.grid(row=1, column=1, padx=5, pady=3, sticky=W + E)
        self.image_path = Tix.Message(tmp,
                                      relief=Tix.FLAT,
                                      width=440,
                                      anchor=Tix.N,
                                      text='vmlinux')
        self.image_path.grid(row=0, column=2, padx=5, pady=3, sticky=W)
        self.conf_path = Tix.Message(tmp,
                                     relief=Tix.FLAT,
                                     width=440,
                                     anchor=Tix.N,
                                     text='skyeye.conf')
        self.conf_path.grid(row=1, column=2, padx=5, pady=3, sticky=W)

        file = Tix.FileEntry(tmp, command=self.image_path_do)
        file.grid(row=0, column=3, padx=5, pady=3, sticky=W + E)
        file = Tix.FileEntry(tmp, command=self.conf_path_do)
        file.grid(row=1, column=3, padx=5, pady=3, sticky=W + E)

        tmp.grid(row=1, column=0, padx=5, pady=10, sticky=W + E)

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

        tmp.grid(row=2, column=0, padx=5, pady=10, sticky=W + E)

        self.run = Tix.Button(tmp, text="Run", command=self.run_skyeye)
        self.kill = Tix.Button(tmp, text="Kill", command=self.kill_skyeye)
        self.kill.config(state=DISABLED)

        self.run.grid(row=0, column=0, padx=5, pady=3, sticky=W + E)
        self.kill.grid(row=0, column=1, padx=5, pady=3, sticky=W + E)

        self.skyeye_redobody()