Exemplo n.º 1
0
    def goto_date_gui(self):
        date_top = Toplevel()
        date_top.title("Enter date")
        date_top.resizable(0, 0)

        # Inputs for month/year
        goto_month = Label(date_top, text="Month:")
        goto_month.grid(row=0, column=0)

        m_entry = Entry(date_top)
        m_entry.grid(row=0, column=1)

        goto_year = Label(date_top, text="Year:")
        goto_year.grid(row=1, column=0)

        y_entry = Entry(date_top)
        y_entry.grid(row=1, column=1)

        def month_jump():
            try:
                month = int(m_entry.get())
                year = int(y_entry.get())

                if 0 < month <= 12 and 1970 <= year < 5000:
                    self.calendar.month = month - 1
                    self.calendar.year = year
                    self.update_calendar()
            except:
                pass

        submit = Button(date_top, text="Submit", command=month_jump)
        submit.grid(column=0, columnspan=3)
def OnButtonClick():
    

    e2.focus_set()
    e2.selection_range(0, END)

    e3.focus_set()
    e3.selection_range(0, END)

    e4.focus_set()
    e4.selection_range(0, END)
    
    win = Toplevel()
    win.title("Program Answer")
    if len(oracle_old_connection(e2.get(), e3.get())) > 0:
        cur = oracle_connection()
        alter_string = 'alter user %s identified by %s' % (e2.get(), e4.get())
        cur.execute(alter_string)
        message = "Password Successfully Updated"
        
        msg = Message(win, text=message)
        msg.pack()
        button = Button(win, text='OK', command=win.destroy)
        button.pack()
    else:
        message = "Error!!!!"
        
        msg = Message(win, text=message)
        msg.pack()
        button = Button(win, text='OK', command=win.destroy)
        button.pack()
Exemplo n.º 3
0
def _calltip_window(parent):  # htest #
    from Tkinter import Toplevel, Text, LEFT, BOTH

    top = Toplevel(parent)
    top.title("Test calltips")
    top.geometry("200x100+%d+%d" % (parent.winfo_rootx() + 200,
                  parent.winfo_rooty() + 150))
    text = Text(top)
    text.pack(side=LEFT, fill=BOTH, expand=1)
    text.insert("insert", "string.split")
    top.update()
    calltip = CallTip(text)

    def calltip_show(event):
        calltip.showtip("(s=Hello world)", "insert", "end")
    def calltip_hide(event):
        calltip.hidetip()
    text.event_add("<<calltip-show>>", "(")
    text.event_add("<<calltip-hide>>", ")")
    # - 2016 9 28 --
    text.event_add('<<calltip-show>>', '<less>')
    text.event_add('<<calltip-hide>>', '<greater>')
    # ---
    text.bind("<<calltip-show>>", calltip_show)
    text.bind("<<calltip-hide>>", calltip_hide)
    text.focus_set()
Exemplo n.º 4
0
def _io_binding(parent):  # htest #
    from Tkinter import Toplevel, Text
    from idlelib.configHandler import idleConf

    root = Toplevel(parent)
    root.title("Test IOBinding")
    width, height, x, y = list(map(int, re.split('[x+]', parent.geometry())))
    root.geometry("+%d+%d"%(x, y + 150))
    class MyEditWin:
        def __init__(self, text):
            self.text = text
            self.flist = None
            self.text.bind("<Control-o>", self.open)
            self.text.bind("<Control-s>", self.save)
        def get_saved(self): return 0
        def set_saved(self, flag): pass
        def reset_undo(self): pass
        def open(self, event):
            self.text.event_generate("<<open-window-from-file>>")
        def save(self, event):
            self.text.event_generate("<<save-window>>")
        def update_recent_files_list(s, f): pass

    text = Text(root)
    text.pack()
    text.focus_set()
    editwin = MyEditWin(text)
    IOBinding(editwin)
Exemplo n.º 5
0
    def set_file(self):
        window = Toplevel(self, bg='#C1CDCD')
        window.title('set_file_size')
        window.geometry('400x400')
        window.resizable(0, 0)  # 禁止调整窗口大小

        file_num = 16
        var = []
        for i in range(file_num):
            var.append(StringVar())
        Label(window, text=u"请填写需要生成的测试文件大小,单位M(无需填满):",
              bg='#C1CDCD').grid(row=0,
                                 column=0,
                                 columnspan=4,
                                 pady=5,
                                 padx=15)
        for j in range(file_num / 2):
            Label(window, text=u"文件大小" + str(j * 2) + ":",
                  bg='#C1CDCD').grid(row=j + 1, column=0, pady=8, padx=10)
            Entry(window, width=10, textvariable=var[j * 2]).grid(row=j + 1,
                                                                  column=1,
                                                                  pady=8,
                                                                  padx=10)
            Label(window, text=u"文件大小" + str(j * 2 + 1) + ":",
                  bg='#C1CDCD').grid(row=j + 1, column=2, pady=8, padx=10)
            Entry(window, width=10,
                  textvariable=var[j * 2 + 1]).grid(row=j + 1,
                                                    column=3,
                                                    pady=8,
                                                    padx=10)

        def get_file_list():
            v3 = ''
            self.file_list[:] = []
            for k in range(file_num):
                v = var[k].get()
                if v == '' or v.isspace() or not v.isdigit():
                    continue
                else:
                    self.file_list.append(int(v))
            self.file_list = list(set(self.file_list))
            if 0 in self.file_list:
                self.file_list.remove(0)
            self.file_list.sort()
            for size in self.file_list:
                v3 = v3 + str(size) + 'M' + ','
            print v3
            self.v3.set(v3)
            window.destroy()

        Button(window,
               text=u"确定",
               width=20,
               command=get_file_list,
               bg='#C1CDCD').grid(row=file_num / 2 + 2,
                                  column=0,
                                  columnspan=4,
                                  pady=8,
                                  padx=10)
        window.protocol("WM_DELETE_WINDOW", window.destroy)
Exemplo n.º 6
0
class ConfusionMatrixViewer():
    def __init__(self, class_number, matrix, kappa):
        self.class_number = class_number
        self.matrix = matrix
        self.kappa = kappa
        
        self.child_window = Toplevel(height = 800, width = 1500)
        self.child_window.title('Verification of image classification')
        
    def run(self):
        confusion_matrix_table = ConfusionMatrixTable(self.child_window, 
                                                self.class_number, self.matrix)
        confusion_matrix_table.pack(padx = 5, pady = 5)
        
        kappa_label = Label(self.child_window, font = BOLD_FONT,
                            text = 'Kappa Coefficient: {0}'.format(self.kappa))
        kappa_label.pack(anchor = 'w', padx = 5)
        
        save_button = Button(self.child_window, text = 'Save Validation', 
                             relief = 'raised', width = 30,
                             command = self._save_validation)
        save_button.pack(anchor = 'center', padx = 5, pady = 5)
        
    def _save_validation(self):
        save_validation_results(self.child_window, self.matrix, self.kappa)
Exemplo n.º 7
0
def save(squares):
    """
    Handle the save key on the main window.
    """
    def save_button_hit():
        """
        Save key (on local window) was hit.  Save the file name entered.
        """
        text_in = save_entry.get().strip()
        if len(text_in) == 0:
            showwarning('Error', 'File name specified is empty.')
            return
        outfile = os.path.join(savedir, text_in)
        with open(outfile, 'w') as fyle:
            for sqr_info in save_squares:
                fyle.write('%d:%d:%s\n' % tuple(save_squares[sqr_info]))
        top.destroy()
    top = Toplevel()
    top.geometry('180x80+800+200')
    top.title('Save a layout')
    save_squares = squares
    savedir = getdir()
    label1 = Label(top, text='File name')
    save_entry = Entry(top)
    label1.grid(row=0)
    save_entry.grid(row=0, column=1, columnspan=2)
    save_entry.focus_set()
    save_button = Button(top, text='SAVE', pady=3,
            command=save_button_hit)
    sspace = Label(top)
    sspace.grid(row=1)
    save_button.grid(row=2, column=1)
    top.mainloop()
Exemplo n.º 8
0
    def about( self ):
        "Display about box."
        about = self.aboutBox
        if about is None:
            bg = 'white'
            about = Toplevel( bg='white' )
            about.title( 'About' )
            info = self.appName + ': a simple network editor for Mini-CCNx - based on Miniedit '
            warning = 'Development version - not entirely functional!'
	    author = 'Carlos Cabral, Jan 2013'
            author2 = 'Miniedit by Bob Lantz <rlantz@cs>, April 2010'
            line1 = Label( about, text=info, font='Helvetica 10 bold', bg=bg )
            line2 = Label( about, text=warning, font='Helvetica 9', bg=bg )
            line3 = Label( about, text=author, font='Helvetica 9', bg=bg )
	    line4 = Label( about, text=author2, font='Helvetica 9', bg=bg )
            line1.pack( padx=20, pady=10 )
            line2.pack(pady=10 )
            line3.pack(pady=10 )
	    line4.pack(pady=10 )
            hide = ( lambda about=about: about.withdraw() )
            self.aboutBox = about
            # Hide on close rather than destroying window
            Wm.wm_protocol( about, name='WM_DELETE_WINDOW', func=hide )
        # Show (existing) window
        about.deiconify()
Exemplo n.º 9
0
    def run(self):
        print "Creating animation server..."
        if os.path.exists(SOCKET_NAME):
            os.remove(SOCKET_NAME)

        self.server = Animator(AnimationRequestHandler, self.simulate)
        if not self.simulate:
            print "Starting animation server..."
            print "Animation server is running on socket {0}".format(
                SOCKET_NAME)
            #print "Quit the server with CONTROL-C."
            self.server.serve_forever()
        else:
            print "Starting simulation..."
            button_window = Toplevel()
            button_window.title('Button Input')
            img = PhotoImage(file="easy_button.gif")
            single_easy_button = Button(button_window, image=img)
            single_easy_button.pack()
            single_easy_button.bind(
                "<Button-1>",
                lambda e: server.processCommand(ButtonEvent.SINGLEPRESS))
            double_easy_button = Button(button_window, text="double tap")
            double_easy_button.pack()
            double_easy_button.bind(
                "<Button-1>",
                lambda e: server.processCommand(ButtonEvent.DOUBLEPRESS))
            mainloop()
Exemplo n.º 10
0
class ConfusionMatrixViewer():
    def __init__(self, class_number, matrix, kappa):
        self.class_number = class_number
        self.matrix = matrix
        self.kappa = kappa

        self.child_window = Toplevel(height=800, width=1500)
        self.child_window.title('Verification of image classification')

    def run(self):
        confusion_matrix_table = ConfusionMatrixTable(self.child_window,
                                                      self.class_number,
                                                      self.matrix)
        confusion_matrix_table.pack(padx=5, pady=5)

        kappa_label = Label(self.child_window,
                            font=BOLD_FONT,
                            text='Kappa Coefficient: {0}'.format(self.kappa))
        kappa_label.pack(anchor='w', padx=5)

        save_button = Button(self.child_window,
                             text='Save Validation',
                             relief='raised',
                             width=30,
                             command=self._save_validation)
        save_button.pack(anchor='center', padx=5, pady=5)

    def _save_validation(self):
        save_validation_results(self.child_window, self.matrix, self.kappa)
Exemplo n.º 11
0
def _calltip_window(parent):  # htest #
    from Tkinter import Toplevel, Text, LEFT, BOTH

    top = Toplevel(parent)
    top.title("Test calltips")
    top.geometry("200x100+%d+%d" %
                 (parent.winfo_rootx() + 200, parent.winfo_rooty() + 150))
    text = Text(top)
    text.pack(side=LEFT, fill=BOTH, expand=1)
    text.insert("insert", "string.split")
    top.update()
    calltip = CallTip(text)

    def calltip_show(event):
        calltip.showtip("(s=Hello world)", "insert", "end")

    def calltip_hide(event):
        calltip.hidetip()

    text.event_add("<<calltip-show>>", "(")
    text.event_add("<<calltip-hide>>", ")")
    # - 2016 9 28 --
    text.event_add('<<calltip-show>>', '<less>')
    text.event_add('<<calltip-hide>>', '<greater>')
    # ---
    text.bind("<<calltip-show>>", calltip_show)
    text.bind("<<calltip-hide>>", calltip_hide)
    text.focus_set()
Exemplo n.º 12
0
    def instructions(self):
        """Open instructions window."""
        # Instantiates separate Toplevel instruction window.
        instr_window = Toplevel(self.root)
        instr_window.geometry('550x575+25+25')
        instr_window.title('Instructions')
        instr_window.wm_iconbitmap(constants.ICO)
        instr_window.resizable(False, False)

        # Creatse Scrollbar and Frame for containing other widgets.
        instr_scroll = Scrollbar(instr_window)
        instr_scroll.pack(fill=Y, side="right")
        instr_frame = Frame(instr_window, bg='white')
        instr_frame.pack(fill=BOTH, side="left")

        # Adds instruction text from constants and adds image of Cinzano's diagram.
        instr = Text(instr_frame,
                     width=65,
                     height=40,
                     padx=10,
                     pady=5,
                     bd=0,
                     wrap="word")
        instr.insert("end", constants.INSTR)
        cdiagram_file = Image.open("./static/cinzano_diagram.PNG")
        cdiagram_file = cdiagram_file.resize((500, 450), Image.ANTIALIAS)
        self.cdiag = ImageTk.PhotoImage(cdiagram_file)
        instr.image_create("end", image=self.cdiag)
        instr.tag_add("top", "1.0", "4.10")
        instr.tag_config("top", font='Times 12 bold')
        instr.tag_add("body", "5.0", "19.20")
        instr.tag_config("body", font='Times 12')
        instr.insert("end", constants.CDIAG)
        instr.pack()
        instr_scroll.config(command=instr.yview)
Exemplo n.º 13
0
def _io_binding(parent):  # htest #
    root = Toplevel(parent)
    root.title("Test IOBinding")
    width, height, x, y = list(map(int, re.split('[x+]', parent.geometry())))
    root.geometry("+%d+%d"%(x, y + 150))
    class MyEditWin:
        def __init__(self, text):
            self.text = text
            self.flist = None
            self.text.bind("<Control-o>", self.open)
            self.text.bind("<Control-s>", self.save)
        def get_saved(self): return 0
        def set_saved(self, flag): pass
        def reset_undo(self): pass
        def open(self, event):
            self.text.event_generate("<<open-window-from-file>>")
        def save(self, event):
            self.text.event_generate("<<save-window>>")
        def update_recent_files_list(s, f): pass

    text = Text(root)
    text.pack()
    text.focus_set()
    editwin = MyEditWin(text)
    IOBinding(editwin)
Exemplo n.º 14
0
class Reminder_Window():



    def start_window(self):
        self.reminder_window = Toplevel()
        self.reminder_window.grab_set()
        self.reminder_window.title('Reminder')
        self.reminder_window.geometry('400x200')
        big_font = tkFont.Font(size=10)
        self.reminder_text_1 = Tkinter.Label(self.reminder_window,
        text='Remind me', font=big_font)
        self.reminder_text_2 = Tkinter.Label(self.reminder_window, \
        text='day(s) before.', font=big_font)
        self.reminder_entry = Tkinter.Entry(self.reminder_window, width=3)
        self.ok_reminder_button = Tkinter.Button(self.reminder_window,
        text='OK', command=self.on_ok_button_press)
        self.back_reminder_button = Tkinter.Button(self.reminder_window, \
        text='Back', command=self.on_back_button_press)


        self.reminder_text_1.place(x=x_reminder_text_1_location, \
        y=y_reminder_texts_location)
        self.reminder_text_2.place(x=x_reminder_text_2_location, \
        y=y_reminder_texts_location)
        self.reminder_entry.place(x=x_reminder_entry_location, \
        y=y_reminder_entry_location)
        self.ok_reminder_button.place(x=x_ok_reminder_button_location, \
        y=y_ok_back_reminder_button_locations)
        self.back_reminder_button.place(x=x_back_reminder_button_location, \
        y=y_ok_back_reminder_button_locations)
        self.reminder_window.mainloop()

    def on_ok_button_press(self):
        entry_reminder_value = self.reminder_entry.get()
        try:
            int_entry_reminder_value = int(entry_reminder_value)
            #print 0 > int_entry_reminder_value, int_entry_reminder_value < 50
            if 0 > int_entry_reminder_value or int_entry_reminder_value > 50:
                print 'hi'
                tkMessageBox.showinfo("Error", \
                'Invalid Entry.  Please enter a number from 0-50')
                self.reminder_window.grab_set()
                self.reminder_window.lift()

            else:
                self.num_of_days_before_to_remind_int = int_entry_reminder_value
                self.reminder_window.destroy()

        except ValueError:
            tkMessageBox.showinfo("Error", \
            'Invalid Entry.  Please enter a number from 0-50')
            self.reminder_window.grab_set()
            self.reminder_window.lift()


    def on_back_button_press(self):
        self.num_of_days_before_to_remind_int = 0
        self.reminder_window.destroy()
Exemplo n.º 15
0
  def select_start_options(self):
    '''
    popup box to select side and difficulty levels
    '''
    print 'select game start options'

    popup = Toplevel(self.gui, width=300, height=110)
    popup.title('Choose Game Side and Level')

    # stays on top of the game canvass
    popup.transient(self.gui)
    popup.grab_set()

    # bind window close events
    popup.bind('<Escape>', lambda e: self.not_selected_start_options(popup))
    popup.protocol("WM_DELETE_WINDOW", lambda : self.not_selected_start_options(popup))

    # choose side
    label1 = Label(popup, text="Side", height=30, width=50)
    label1.place(x=10, y=5, height=30, width=50)

    val1 = IntVar()

    bt_north = Radiobutton(popup, text="White", variable=val1, value=1)
    bt_north.place(x=60, y=10)
    bt_south = Radiobutton(popup, text="Black", variable=val1, value=2)
    bt_south.place(x=120, y=10)

    # by default, human plays first, meaning play the north side
    if self.choose_side == 'north':
      bt_north.select()
    else:
      bt_south.select()

    # choose difficulty level
    label2 = Label(popup, text="Level", height=30, width=50)
    label2.place(x=10, y=35, height=30, width=50)

    val2 = IntVar()

    bt_level1 = Radiobutton(popup, text="Dumb", variable=val2, value=1)
    bt_level1.place(x=60, y=40)
    bt_level2 = Radiobutton(popup, text="Smart", variable=val2, value=2)
    bt_level2.place(x=120, y=40)
    bt_level3 = Radiobutton(popup, text="Genius", variable=val2, value=3)
    bt_level3.place(x=180, y=40)

    # by default, the game is medium level
    if self.choose_level == 1:
      bt_level1.select()
    elif self.choose_level == 2:
      bt_level2.select()
    elif self.choose_level == 3:
      bt_level3.select()

    button = Button(popup, text='SET', \
              command=lambda: self.selected_start_options(popup, val1, val2))

    button.place(x=70, y=70)
Exemplo n.º 16
0
def bootstrap_chargenColor(app):
    # Bootstrap app
    global rootC
    rootC = Toplevel(app)
    rootC.title(' ChargenColor v2.05')
    # Initialize ChargenColor
    global chargenColor
    chargenColor = ChargenColor(rootC)
Exemplo n.º 17
0
def new_pop_up(title_string, message_string):
    ''' Defines a new top level window for a quick message to the user '''
    popup = Toplevel()
    popup.title(title_string)
    popup.minsize(250, 20)
    popup.resizable(False, False)
    Message(popup, text=message_string, width=250).pack()
    Button(popup, text="Dismiss", command=popup.destroy).pack()
Exemplo n.º 18
0
 def browser(self, filename):
     new = Toplevel()  # make new window
     text = ScrolledText(new, height=30, width=90)  # Text with scrollbar
     text.config(font=('courier', 10, 'normal'))  # use fixed-width font
     text.pack()
     new.title("Text Viewer")  # set window mgr attrs
     new.iconname("browser")
     text.insert('0.0', open(filename, 'r').read())  # insert file's text
Exemplo n.º 19
0
    def popupControls(self, tl = None):
        from direct.showbase import TkGlobal
        import math
        from Tkinter import Toplevel, Frame, Button, LEFT, X
        import Pmw
        from direct.tkwidgets import EntryScale
        if tl == None:
            tl = Toplevel()
            tl.title('Interval Controls')
        outerFrame = Frame(tl)

        def entryScaleCommand(t, s = self):
            s.setT(t)
            s.pause()

        self.es = es = EntryScale.EntryScale(outerFrame, text=self.getName(), min=0, max=math.floor(self.getDuration() * 100) / 100, command=entryScaleCommand)
        es.set(self.getT(), fCommand=0)
        es.pack(expand=1, fill=X)
        bf = Frame(outerFrame)

        def toStart(s = self, es = es):
            s.clearToInitial()
            es.set(0, fCommand=0)

        def toEnd(s = self):
            s.pause()
            s.setT(s.getDuration())
            es.set(s.getDuration(), fCommand=0)
            s.pause()

        jumpToStart = Button(bf, text='<<', command=toStart)

        def doPlay(s = self, es = es):
            s.resume(es.get())

        stop = Button(bf, text='Stop', command=lambda s = self: s.pause())
        play = Button(bf, text='Play', command=doPlay)
        jumpToEnd = Button(bf, text='>>', command=toEnd)
        jumpToStart.pack(side=LEFT, expand=1, fill=X)
        play.pack(side=LEFT, expand=1, fill=X)
        stop.pack(side=LEFT, expand=1, fill=X)
        jumpToEnd.pack(side=LEFT, expand=1, fill=X)
        bf.pack(expand=1, fill=X)
        outerFrame.pack(expand=1, fill=X)

        def update(t, es = es):
            es.set(t, fCommand=0)

        if not hasattr(self, 'setTHooks'):
            self.setTHooks = []
        self.setTHooks.append(update)

        def onDestroy(e, s = self, u = update):
            if u in s.setTHooks:
                s.setTHooks.remove(u)

        tl.bind('<Destroy>', onDestroy)
        return
Exemplo n.º 20
0
class ServerInfoWindow:
    combined_commands = [
        "uptime",
        "users",
        "uname -a",
        "w",
        "who",
        "df -h",
        "cat /etc/hosts",
        "free -h",
        "iostat",
        "vmstat",
    ]

    command_list = [
        "last",
        "ps aux",
        "vmstat -stats",
        "netstat -l",
        "netstat -t",
        "netstat -u",
        "netstat -x",
        "lscpu",
        "ls ~",
    ]

    def __init__(self, name, ssh_connection=None):
        self.name = name
        self.ssh = ssh_connection
        self.window = Toplevel()
        self.window.geometry("800x600")
        self.window.title(name)
        self.window.option_add("*Font", "TkFixedFont")

        self.command_notebook = ttk.Notebook(self.window)
        self.pack_all_command_tabs()
        self.command_notebook.pack(fill=BOTH, expand=1)

    def bring_to_front(self):
        self.window.focus_force()

    def pack_all_command_tabs(self):
        # Combined commands in one tab
        combined_commands_txt = Text(self.command_notebook)
        combined_commands_txt.tag_config("highlight", foreground="blue")
        for command in self.combined_commands:
            stdin, stdout, stderr = self.ssh.exec_command(command)
            combined_commands_txt.insert(END, ("===== " + command + " =====\n").encode("utf-8"), ("highlight",))
            combined_commands_txt.insert(END, stdout.read())
        self.command_notebook.add(combined_commands_txt, text="Info")

        # Individual commands that get their own tab
        for command in self.command_list:
            stdin, stdout, stderr = self.ssh.exec_command(command)
            command_txt = Text(self.command_notebook)
            command_txt.insert(END, stdout.read())
            self.command_notebook.add(command_txt, text=command)
Exemplo n.º 21
0
 def display_error(self, text_message):
     top = Toplevel()
     x = self.master.winfo_rootx()
     y = self.master.winfo_rooty()
     top.geometry("+%d+%d" %(x+250,y+150))
     #top.geometry("+550+350")
     top.title('Error')
     Tkinter.Label(top, text=text_message).grid(row=1, sticky='W')
     Tkinter.Button(top, text="OK", command=top.destroy).grid(row=2)
Exemplo n.º 22
0
def About():
    top = Toplevel()
    top.title("About this application...")
    msg = Message(top,
                  text="Turing Machine simulator\nWritten on python 2.7 \
                              using Tkinter\n2016 Kyiv, IASA\nby Illya Barziy")
    msg.pack()
    button = Button(top, text="OK", command=top.destroy)
    button.pack()
Exemplo n.º 23
0
    def about(self, event=None):
        """!
        Display the information window for the software.
        @param self The pointer for the object
        @event The handle for the mouse click event
        """
        about_window = Toplevel(self.root, bg='white')
        about_window.title('About')
        #Add the toolbar icon
        about_window.tk.call("wm", "iconphoto", about_window._w, self.icon)
        #Create frames for use
        about_frame = StdFrame(about_window)
        version_frame = StdFrame(about_window)

        #Add information to about frame
        StdLabel(about_frame,
                 text='pyLogger',
                 font=tkFont.Font(family='Arial',
                                  size='20',
                                  weight='bold'),
                 justify=CENTER,
                 ).grid(row=0)
        description = 'pyLogger is a simple data logging application.\n\n'\
                      'pyLogger can communicate with a Mecmesin AFG \n'\
                      'series load cell or a TSI 4000 '\
                      'Series flow meter.\n\n'\
                      'Author: Ben Johnston (ext 101859)\n'\
                      'License: GNU GPL v2.0'
        StdLabel(about_frame,
                 text=description,
                 justify=LEFT).grid(row=1, padx=5, pady=5)
        StdLabel(about_frame,
                 text='Version Information:',
                 font=tkFont.Font(family='Arial',
                                  size='16',
                                  weight='bold'),
                 justify=LEFT).grid(row=2, padx=5, pady=5,
                                    sticky='W')
        StdLabel(about_frame,
                 text='pyLogger Ver: %s' % self.version,
                 justify=LEFT).grid(row=3, sticky='W')
        StdLabel(about_frame,
                 text='Standard Toolbox Ver: %s' % std_rev,
                 justify=LEFT).grid(row=4, sticky='W')
        StdLabel(about_frame,
                 text='TSI Driver Ver: %s' % TSI_rev,
                 justify=LEFT).grid(row=5, sticky='W')
        StdLabel(about_frame,
                 text='AFG Driver Ver: %s' % AFG_rev,
                 justify=LEFT).grid(row=6, sticky='W')

        #Display frames
        about_frame.grid()
        version_frame.grid()
        #Centre window
        self.centre_window(about_window)
Exemplo n.º 24
0
    def king_in_danger(self):
        movement = {
            "PAWN": self.pawn_movement, "ROOK": self.rook_movement, "ROOK.": self.rook_movement,
            "KNIGHT": self.knight_movement, "KNIGHT.": self.knight_movement,
            "BISHOP": self.bishop_movement, "BISHOP.": self.bishop_movement,
            "QUEEN": self.queen_movement, "KING": self.king_movement,
            "pawn": self.pawn_movement, "rook": self.rook_movement, "rook.": self.rook_movement,
            "knight": self.knight_movement, "knight.": self.knight_movement,
            "bishop": self.bishop_movement, "bishop.": self.bishop_movement,
            "queen": self.queen_movement, "king": self.king_movement, "": self.pass_this}

        king_row = 1
        king_col = 1
        king_row1 = 1
        king_col1 = 1

        # Finds the king for each side
        for row2 in range(1, 9):
            for col2 in range(1, 9):
                piece_text = self.button_location[row2, col2]["text"]
                piece_row1 = row2
                piece_col1 = col2
                if piece_text == "KING":
                    king_row = piece_row1
                    king_col = piece_col1
                if piece_text == "king":
                    king_row1 = piece_row1
                    king_col1 = piece_col1
        self.white_king_locations.append((king_row, king_col))
        self.black_king_locations.append((king_row1, king_col1))

        # Runs each piece's movement in their specific location to see if they put the king in Check
        done = False
        for row1 in range(1, 9):
            if done:
                break
            for column1 in range(1, 9):
                piece_text = self.button_location[row1, column1]["text"]
                piece_color = self.button_location[row1, column1]["fg"]
                piece_row = row1
                piece_col = column1
                movement.get(piece_text)(row=piece_row, col=piece_col, color=piece_color)
                if self.button_location[king_row, king_col]["bg"] == "Green":
                    check_window = Toplevel()
                    check_window.title("CHECK!")
                    label = Label(check_window, text="CHECK!", height=20, width=50, fg="Blue")
                    label.pack()
                    done = True
                    break
                if self.button_location[king_row1, king_col1]["bg"] == "Green":
                    check_window = Toplevel()
                    check_window.title("CHECK!")
                    label = Label(check_window, text="CHECK!", height=20, width=50, fg="Red")
                    label.pack()
                    done = True
                    break
Exemplo n.º 25
0
	def onSetParams(self):
		top = Toplevel(self.parent)
		top.title("Model Setup")
		msg = Message(top, text="")
		msg.pack()
		
		applyb = Button(top, text="Apply", command=top.destroy)
		closeb = Button(top, text="Close", command=top.destroy)
		applyb.pack()
		closeb.pack()
Exemplo n.º 26
0
 def info(self):
     #Infoseite zeigen
     top = Toplevel()
     top.title(u"Über dieses Programm...")
     
     msg = Message(top, text=u'Dieses Programm dient zur Auswertung von Messungen für die Bestimmung des Weiterreißwiderstands nach DIN ISO 6133:2004-05\n\nZur Detektion der Maxima dient ein Algorithmus aus MATLAB (http://billauer.co.il/peakdet.html) verwendet, welcher nach Python übersetzt wurden.\n\nDas Programm entscheidet je nach Anzahl der Maxima selbst, welche Vorgabe für die Auswertung zu verwenden ist.\n\n\n\nErstellt von Lukas Scheffler')
     msg.pack()
     
     button = Button(top, text="Verbergen", command=top.destroy)
     button.pack()
 def message_box_notification(self, txt):
     #crate the top level for message box
     mess_box = Toplevel()
     mess_box.title("Message")
     #create the message text
     msg = Message(mess_box, text = txt)
     msg.pack()
     #create top level close button
     mess_box_close = Button(mess_box, text = "OK", command = mess_box.destroy)
     mess_box_close.pack()
Exemplo n.º 28
0
 def show_about():
     t = Toplevel(master)
     t.title("About")
     t.transient(master)
     t.resizable(False, False)
     Label(t, image=self.img_logo).grid(column=0, row=0, sticky=(E, W))
     Label(t, text="Context %s" % VERSION, anchor=CENTER).grid(column=0, row=1, sticky=(E, W))
     Label(t, text="(c) 2011-2014 Shish", anchor=CENTER).grid(column=0, row=2, sticky=(E, W))
     Button(t, text="Close", command=t.destroy).grid(column=0, row=3, sticky=(E,))
     win_center(t)
Exemplo n.º 29
0
class LBChoice(object):
    '''This is a listbox for returning projects to be unarchived.'''
    def __init__(self, list_=None, master=None, title=None):
        '''Must have master, title is optional, li is too.'''
        self.master = master
        if self.master is not None:
            self.top = Toplevel(self.master)
        else:
            return
        self.v = None
        if list_ is None or not isinstance(list_, list):
            self.list = []
        else:
            self.list = list_[:]
        self.top.transient(self.master)
        self.top.grab_set()
        self.top.bind("<Return>", self._choose)
        self.top.bind("<Escape>", self._cancel)
        if title:
            self.top.title(title)
        lf = Frame(self.top)         #Sets up the list.
        lf.pack(side=TOP)
        scroll_bar = Scrollbar(lf)
        scroll_bar.pack(side=RIGHT, fill=Y)
        self.lb = Listbox(lf, selectmode=SINGLE)
        self.lb.pack(side=LEFT, fill=Y)
        scroll_bar.config(command=self.lb.yview)
        self.lb.config(yscrollcommand=scroll_bar.set)
        self.list.sort()
        for item in self.list:
            self.lb.insert(END, item)     #Inserts items into the list.
        bf = Frame(self.top)
        bf.pack(side=BOTTOM)
        Button(bf, text="Select", command=self._choose).pack(side=LEFT)
        Button(bf, text="New", command=self._new).pack(side=LEFT)
        Button(bf, text="Cancel", command=self._cancel).pack(side=LEFT)

    def _choose(self, event=None):
        try:
            first = self.lb.curselection()[0]
            self.v = self.list[int(first)]
        except IndexError:
            self.v = None
        self.top.destroy()

    def _new(self, event=None):
        self.v = "NEW"
        self.top.destroy()

    def _cancel(self, event=None):
        self.top.destroy()

    def return_value(self):
        self.master.wait_window(self.top)
        return self.v
Exemplo n.º 30
0
class SshUserPw(object):
    '''
    A separate GUI window to enter the SSH username and password
    '''
    def __init__(self, callback):
        self._callback = callback

        self._root = Toplevel()
        self._root.title('FlowEntry Trace')
        self._root.minsize(width=300, height=150)

        self._top_frame = Frame(self._root)
        self._top_frame.pack(side=TOP, fill=X, padx=10, pady=10)

        # The text labels
        label_entry_frame = Frame(self._top_frame)
        label_entry_frame.pack(side=TOP, anchor=W, pady=5)
        self._username_label = LabelEntry(label_entry_frame, 'username')
        self._password_label = LabelEntry(label_entry_frame, 'password')

        # the buttons
        button_frame = Frame(self._top_frame, pady=5)
        button_frame.pack(side=BOTTOM, anchor=S)
        buttons_dict = OrderedDict([('ok', self._ok_callback),
                                    ('cancel', self._cancel_callback)])
        Buttons(button_frame, buttons_dict, button_orientation=LEFT)

        # Hide this window until its needed
        self._root.withdraw()

    @property
    def username(self):
        return self._username_label.entry_text

    @property
    def password(self):
        return self._password_label.entry_text

    def display(self, show=True):
        if show:
            self._root.update()
            self._root.deiconify()
        else:
            self._root.withdraw()

    def _cancel_callback(self):
        self.display(False)

    def _ok_callback(self):
        if not self.username or not self.password:
            Popup('Both the username and password must be filled in')
            return

        self.display(False)
        self._callback()
Exemplo n.º 31
0
class LBChoice(object):
    '''This is a listbox for returning projects to be unarchived.'''
    def __init__(self, list_=None, master=None, title=None):
        '''Must have master, title is optional, li is too.'''
        self.master = master
        if self.master is not None:
            self.top = Toplevel(self.master)
        else:
            return
        self.v = None
        if list_ is None or not isinstance(list_, list):
            self.list = []
        else:
            self.list = list_[:]
        self.top.transient(self.master)
        self.top.grab_set()
        self.top.bind("<Return>", self._choose)
        self.top.bind("<Escape>", self._cancel)
        if title:
            self.top.title(title)
        lf = Frame(self.top)  #Sets up the list.
        lf.pack(side=TOP)
        scroll_bar = Scrollbar(lf)
        scroll_bar.pack(side=RIGHT, fill=Y)
        self.lb = Listbox(lf, selectmode=SINGLE)
        self.lb.pack(side=LEFT, fill=Y)
        scroll_bar.config(command=self.lb.yview)
        self.lb.config(yscrollcommand=scroll_bar.set)
        self.list.sort()
        for item in self.list:
            self.lb.insert(END, item)  #Inserts items into the list.
        bf = Frame(self.top)
        bf.pack(side=BOTTOM)
        Button(bf, text="Select", command=self._choose).pack(side=LEFT)
        Button(bf, text="New", command=self._new).pack(side=LEFT)
        Button(bf, text="Cancel", command=self._cancel).pack(side=LEFT)

    def _choose(self, event=None):
        try:
            first = self.lb.curselection()[0]
            self.v = self.list[int(first)]
        except IndexError:
            self.v = None
        self.top.destroy()

    def _new(self, event=None):
        self.v = "NEW"
        self.top.destroy()

    def _cancel(self, event=None):
        self.top.destroy()

    def return_value(self):
        self.master.wait_window(self.top)
        return self.v
Exemplo n.º 32
0
    def initUI(self):
        # Main Window
        self.parent.title("gBot")
        self.style = Style()
        self.style.theme_use("default")
        self.pack(fill=BOTH, expand=1)

        # Debug Window
        Toplevel1 = Toplevel(self)
        Toplevel1.title("gBot Debug Console")
        self.pack(fill=BOTH, expand=1)
        TL_T1 = Text(Toplevel1, width=50)
        TL_T1.pack()
        Toplevel1.state("withdrawn")
        Toplevel1.protocol('WM_DELETE_WINDOW', lambda:Toplevel1.state("withdrawn"))
        Toplevel1.attributes("-topmost", True)

        # Username Input
        L1 = Label(self, text="G+ User Name")
        L1.grid(row=0, column=0, sticky=E, ipady=1)
        E1 = Entry(self, width=30)
        E1.grid(row=0, column=1, ipady=1, sticky=E)

        # Password Input
        L2 = Label(self, text="G+ Password")
        L2.grid(row=1, column=0, sticky=E, ipady=1)
        E2 = Entry(self, width=30)
        E2.grid(row=1, column=1, ipady=1, sticky=E)

        # Output Path Input
        L3 = Label(self, text="Output Path")
        L3.grid(row=2, column=0, sticky=E, pady=1)
        E3 = Entry(self, width=30)
        E3.grid(row=2, column=1, ipady=1, sticky=E)
        E3.insert(0, "%s\links.txt" % (os.getcwd()))

        # Num Posts
        L4 = Label(self, text="# Of Posts")
        L4.grid(row=3, column=0, sticky=E, pady=1)
        S1 = Spinbox(self, from_=1, to=9999999, width=28)
        S1.grid(row=3, column=1, ipady=1, sticky=E)
        
        # Post Input
        T1 = Text(self, width=30)
        T1.grid(row=5, columnspan=2, sticky=W+E, pady=1)
        
        # Start button
        B1 = Button(self, text="Start Posting", command=lambda:self.doPosting(B1,TL_T1,E1.get(),E2.get(),T1.get(1.0,END),E3.get(),S1.get()))
        B1.grid(row=6,columnspan=2, sticky=W+E)

        # Debug button
        B2 = Button(self, text="Debug log", command=lambda:Toplevel1.state("normal"))
        B2.grid(row=7, columnspan=2, sticky=W+E)

        self.addDebug(TL_T1,"Started successfully")
Exemplo n.º 33
0
class LispToplevelClass(BuildInFunction):
    def __init__(self):
        self.value=Toplevel()
    def execute(self,env, *unEvalArgs):
        arg = LISP.Eval.evall(unEvalArgs[0], env)
        if(arg == new(LispSymbol,"setTitle")):
            arg1 = LISP.Eval.evall(unEvalArgs[1], env)
            self.value.title(arg1)
    def execute_ea(self,*args):
        if(args[0] == new(LispSymbol,"setTitle")):
            self.value.title(args[0])     
Exemplo n.º 34
0
 def About(self):
     top = Toplevel()
     top.title("PlaNet standalone")
     label = Label(
         top,
         text=
         "PlaNet standalone\nMarek Mutwil\ncontact: [email protected]",
         width=30)
     OkButton = Button(top, text="OK", command=top.destroy)
     label.pack()
     OkButton.pack()
Exemplo n.º 35
0
def make_error_dialog(player_dlg):
    error_dlg = Toplevel(master=player_dlg);
    error_dlg.title( "Error" );
    error_dlg.grab_set();
    error_msg = Message(error_dlg, aspect=300, text="Player count must be between %d and %d" % (MIN_PLAYER_COUNT, MAX_PLAYER_COUNT) )
    error_msg.pack();
    error_button = Button(error_dlg, text="OK", \
                            command=error_dlg.destroy);
    error_button.pack();
    error_dlg.update();
    return
Exemplo n.º 36
0
	def help_f(self):
		top = Toplevel()
		top.title("HELP")
		msg = Message(top, width= 500,
                 text="Noise Threshold (NT) - Noise Based Main Threshold \
(Sigmas)\n Threshold 1 - Main Threshold (LSBs) \n Threshold 2 - End of Pulse Error \n \
Threshold 3 - End of Tail Error \n When Thr1 = Thr3 = 0 their values are defined as: \n \
(THR1 = NT (LSBs) / THR3 = NT*NOISE_ADC / 5)")
		msg.pack()

		button = Button(top, text="Close", command=top.destroy)
		button.pack()
Exemplo n.º 37
0
 def Error(self, error="Se produjo un error"):
     Ventana2 = Toplevel(self.master)
     Ventana2.configure(height=100, width=260, bg="#4a4a4a")
     Ventana2.title("Error")
     Error = Label(Ventana2, text=error, bg="#4a4a4a", fg="#FFFFFF")
     Error.place(x=40, y=15)
     Error.config(font=("", 12))
     Salir = Button(Ventana2,
                    width=10,
                    text="Salir",
                    command=Ventana2.destroy)
     Salir.place(x=85, y=55)
Exemplo n.º 38
0
 def display_help(self, event=None):
     """
     Display a new window with help-text from file 'help.txt'
     """
     help = Toplevel()
     help.title("Help and usage")
     path = os.path.abspath(__file__).rsplit("/", 1)[0]
     f = open(u"{}/help.txt".format(path), "r")
     helptext = f.read()
     f.close
     helplabel = Label(help, text=helptext, relief=RIDGE, padx=15, pady=15, anchor="w", justify=LEFT, bg="white")
     helplabel.pack(side=TOP, fill=BOTH, expand=YES)
Exemplo n.º 39
0
class ServerInfoWindow:
    combined_commands = [
        'uptime',
        'users',
        'uname -a',
        'w',
        'who',
        'df -h',
        'cat /etc/hosts',
        'free -h',
        'iostat',
        'vmstat',
    ]

    command_list = [
        'last', 'ps aux', 'vmstat -stats', 'netstat -l', 'netstat -t',
        'netstat -u', 'netstat -x', 'lscpu', 'ls ~'
    ]

    def __init__(self, name, ssh_connection=None):
        self.name = name
        self.ssh = ssh_connection
        self.window = Toplevel()
        self.window.geometry('800x600')
        self.window.title(name)
        self.window.option_add("*Font", "TkFixedFont")

        self.command_notebook = ttk.Notebook(self.window)
        self.pack_all_command_tabs()
        self.command_notebook.pack(fill=BOTH, expand=1)

    def bring_to_front(self):
        self.window.focus_force()

    def pack_all_command_tabs(self):
        # Combined commands in one tab
        combined_commands_txt = Text(self.command_notebook)
        combined_commands_txt.tag_config('highlight', foreground='blue')
        for command in self.combined_commands:
            stdin, stdout, stderr = self.ssh.exec_command(command)
            combined_commands_txt.insert(END, ("===== " + command +
                                               " =====\n").encode('utf-8'),
                                         ('highlight', ))
            combined_commands_txt.insert(END, stdout.read())
        self.command_notebook.add(combined_commands_txt, text='Info')

        # Individual commands that get their own tab
        for command in self.command_list:
            stdin, stdout, stderr = self.ssh.exec_command(command)
            command_txt = Text(self.command_notebook)
            command_txt.insert(END, stdout.read())
            self.command_notebook.add(command_txt, text=command)
Exemplo n.º 40
0
    def about(self, event=None):
        """!
        Display the information window for the software.
        @param self The pointer for the object
        @event The handle for the mouse click event
        """
        about_window = Toplevel(self.root, bg='white')
        about_window.title('About')
        #Add the toolbar icon
        about_window.tk.call("wm", "iconphoto", about_window._w, self.icon)
        #Create frames for use
        about_frame = StdFrame(about_window)
        version_frame = StdFrame(about_window)

        #Add information to about frame
        StdLabel(
            about_frame,
            text='pyLogger',
            font=tkFont.Font(family='Arial', size='20', weight='bold'),
            justify=CENTER,
        ).grid(row=0)
        description = 'pyLogger is a simple data logging application.\n\n'\
                      'pyLogger can communicate with a Mecmesin AFG \n'\
                      'series load cell or a TSI 4000 '\
                      'Series flow meter.\n\n'\
                      'Author: Ben Johnston (ext 101859)\n'\
                      'License: GNU GPL v2.0'
        StdLabel(about_frame, text=description, justify=LEFT).grid(row=1,
                                                                   padx=5,
                                                                   pady=5)
        StdLabel(about_frame,
                 text='Version Information:',
                 font=tkFont.Font(family='Arial', size='16', weight='bold'),
                 justify=LEFT).grid(row=2, padx=5, pady=5, sticky='W')
        StdLabel(about_frame,
                 text='pyLogger Ver: %s' % self.version,
                 justify=LEFT).grid(row=3, sticky='W')
        StdLabel(about_frame,
                 text='Standard Toolbox Ver: %s' % std_rev,
                 justify=LEFT).grid(row=4, sticky='W')
        StdLabel(about_frame,
                 text='TSI Driver Ver: %s' % TSI_rev,
                 justify=LEFT).grid(row=5, sticky='W')
        StdLabel(about_frame,
                 text='AFG Driver Ver: %s' % AFG_rev,
                 justify=LEFT).grid(row=6, sticky='W')

        #Display frames
        about_frame.grid()
        version_frame.grid()
        #Centre window
        self.centre_window(about_window)
Exemplo n.º 41
0
        def helpbounds(evemt):
            helpboundsw = Toplevel()
            helpboundsw.title("Help: Bounds")
            helpboundsw.config(bg=Styles.colours["grey"], padx=10, pady=10)

            boundswindowheader = header(helpboundsw, "How to set bounds?")
            t = Text(helpboundsw, width=30, height=20, relief=FLAT, bg=Styles.colours["grey"], wrap=WORD,
                     font=Styles.fonts["entryFilled"])
            t.insert(END,
                     " The bounds give the model maximum and minimum for each input parameter value. You can set the bounds from a file in CSV file"
                     "where first column is the minimum and second column is the maximum, or through the window presented prior.")
            boundswindowheader.grid(row=0, column=0)
            t.grid(row=1, column=0)
Exemplo n.º 42
0
Arquivo: CTA.py Projeto: Panumy/CTA-DB
def no_acc():
    global win2, habusrenr
    win2 = Toplevel(root)
    win2.geometry('250x50')
    win2.iconbitmap('Logo.ico')
    win2.resizable(width=FALSE, height=FALSE)
    win2.title("Support")
    habusrlab = Label(win2, text="Full Name")
    habusrenr = Entry(win2)
    habusrbtt = Button(win2, text="Send", command=send_acc_req)
    habusrlab.grid(column=0, row=0)
    habusrenr.grid(column=1, row=0)
    habusrbtt.place(relx=0.6, x=1, y=22.5, anchor=NE)
Exemplo n.º 43
0
    def help_f(self):
        top = Toplevel()
        top.title("HELP")
        msg = Message(top,
                      width=500,
                      text="Noise Threshold (NT) - Noise Based Main Threshold \
(Sigmas)\n Threshold 1 - Main Threshold (LSBs) \n Threshold 2 - End of Pulse Error \n \
Threshold 3 - End of Tail Error \n When Thr1 = Thr3 = 0 their values are defined as: \n \
(THR1 = NT (LSBs) / THR3 = NT*NOISE_ADC / 5)")
        msg.pack()

        button = Button(top, text="Close", command=top.destroy)
        button.pack()
Exemplo n.º 44
0
class RobView(View):
    GUI_WIDTH = 800
    GUI_HEIGHT = 400
    
    def __init__(self, tkRoot, app, masterComp, parentNode, logger):
        BaseView.__init__(self, tkRoot, app, logger)
        # master (upper level view) component on which this view was issued
        self.masterComp = masterComp
        
        self.parentNode = parentNode
                             
        self.window = Toplevel(self.tkRoot)
        self.window.title("%s" % parentNode.keyForIsObject)
        
        # self.window.bind("<<close-window>>", self.__onClose) # doesn't work
        self.window.protocol("WM_DELETE_WINDOW", self.__onClose)
        
        text = ScrolledText(self.window, width = RobView.GUI_WIDTH,
                            height = RobView.GUI_HEIGHT, background='white')
        text.pack(fill = Y)
        
        # information from ROB (DataChannel) IS object (criteria results)
        # .valueOfIsObject is a bit misleading since it's criteria results
        # checks based on particular values (attributes) within the IS object
        m = ("ROB '%s':\n\n%s" %
             (parentNode.keyForIsObject, parentNode.valueOfIsObject))
        text.insert(END, m)
        
        text.configure(state = DISABLED) # disable edit now, not before insert
        
        # need to store this view under full name (not only under 
        # self.masterComp.name as the other views), since there may be 
        # a number of views named e.g. 'DataChannel0'
        self.app.addActiveView(self.parentNode.keyForIsObject, self)

        
    def createContent(self):
        self.__setWindowGeometry()
        
        
    def __setWindowGeometry(self):
        offsetX = View.ANOTHER_GUI_OFF * self.app.activeViewsCount()
        x = conf.GUI_OFF_X + conf.GUI_WIDTH + offsetX
        geom = "%sx%s+%s+%s" % (RobView.GUI_WIDTH, RobView.GUI_HEIGHT, 
                                x, conf.GUI_OFF_Y)
        self.window.geometry(geom)

        
    def __onClose(self):
        self.app.removeActiveView(self.parentNode.keyForIsObject)
        self.window.destroy()
Exemplo n.º 45
0
    def __init__(self, master, main_window):
	self.master = master
	self.main_window = main_window

	top = Toplevel(master)
	top.title(_("Global Options"))
	top.transient(master)
	top.protocol('WM_DELETE_WINDOW', self.close_dlg)

	top.geometry('%+d%+d' % (master.winfo_rootx() + 100,
				 master.winfo_rooty() + 100))

	self.top = top
	self.build_dlg()
Exemplo n.º 46
0
    def __init__(self, master, main_window):
        self.master = master
        self.main_window = main_window

        top = Toplevel(master)
        top.title(_("Global Options"))
        top.transient(master)
        top.protocol('WM_DELETE_WINDOW', self.close_dlg)

        top.geometry('%+d%+d' %
                     (master.winfo_rootx() + 100, master.winfo_rooty() + 100))

        self.top = top
        self.build_dlg()
Exemplo n.º 47
0
def excel_popup(field):
    sub_window = Toplevel(background="#333", padx=15, pady=15)
    sub_window.title("Aya's Finder: Import data from Excel file")
    sub_window.wm_iconbitmap(r"images\Dna-Helix.ico")
    row_col = StringVar()
    row_col.set("row")

    Radiobutton(sub_window, variable=row_col, value="row", text="Row").grid(row=0, column=0)
    Radiobutton(sub_window, variable=row_col, value="col", text="Column").grid(row=0, column=1)
    file_name_var = StringVar()
    sheet_name_var = StringVar()
    num_var = IntVar()

    Label(sub_window, justify="left", width="17", text="File name").grid(row=1, column=0)
    Label(sub_window, justify="left", width="17", text="Sheet name").grid(row=2, column=0)
    Label(sub_window, justify="left", width="17", text="Row/Column number").grid(row=3, column=0)
    Entry(sub_window, width="32", textvariable=file_name_var).grid(row=1, column=1)
    Entry(sub_window, width="7", textvariable=num_var).grid(row=3, column=1)
    sheets = OptionMenu(sub_window, sheet_name_var, '')
    sheets.config(width=32)
    sheets.grid(row=2, column=1)

    def get():
        file_name = file_name_var.get()
        sheet_name = sheet_name_var.get()
        num = num_var.get()
        try:
            if row_col.get() == "row":
                field.delete(1.0, END)
                field.insert(INSERT, get_from_excel(file_name, sheet_name, row_num=num))
            else:
                field.delete(1.0, END)
                field.insert(INSERT, get_from_excel(file_name, sheet_name, col_num=num))
            sub_window.destroy()
        except Exception:
            pass

    def browser():
        try:
            name = askopenfilename(parent=sub_window)
            file_name_var.set(name)
            sheets.set_menu('---', *get_excel_sheets(file_name_var.get()))
            sub_window.focus()
        except IOError:
            pass

    Button(sub_window, text="OK", command=get).grid(row=5, column=0)
    Button(sub_window, text="Cancel", command=lambda: sub_window.destroy()).grid(row=5, column=1)
    Button(sub_window, text="browse", command=browser).grid(row=1, column=3)
Exemplo n.º 48
0
 def __init__(self, parent, title,display_it):
     self.display_it=display_it
     self.errors=0
     self.warnings=0
     if self.display_it is False: return
     top = Toplevel()
     top.title(title)
     scrollbar = Scrollbar(top, orient=VERTICAL)
     self.textb = Text(top,width=80,height=40, wrap='word', font="arial 11",padx=5,yscrollcommand=scrollbar.set)
     scrollbar.config(command=self.textb.yview)
     scrollbar.pack(side=RIGHT, fill=Y)
     self.textb.pack(side=LEFT, fill=BOTH, expand=1)
     self.textb.config(state=NORMAL)
     self.textb.delete(1.0, END)
     self.textb.config(state=DISABLED)
Exemplo n.º 49
0
def view_stack():
    inputstring = u2_entry.get()
    row, ste, sta, inp, act = process_input(inputstring)
    print inputstring

    show = Toplevel(master)
    show.title("Stack Implementation")
    show.geometry("%dx%d%+d%+d" % (1300, 1300, 0, 0))
    canvas = Canvas(show, width=2000, height=1000)
    canvas.grid(row=0, column=0)
    row = row - 1
    col = 4
    m, a = 10, 10
    n = 100
    b = 125

    for i in range(len(sta)):
        canvas.create_text(a + 60, b + 15, text=i + 1, font="Times 15 bold")
        canvas.create_text(a + 60 + 260,
                           b + 15,
                           text=sta[i],
                           font="Times 15 bold")
        canvas.create_text(a + 60 + 400,
                           b + 15,
                           text=inp[i],
                           font="Times 15 bold")
        canvas.create_text(a + 60 + 660,
                           b + 15,
                           text=act[i],
                           font="Times 15 bold")

        b = b + 30

    for i in range(0, row + 1):
        for j in range(0, col):
            print(m, n)

            canvas.create_rectangle(m, n, m + 200, n + 30)
            m = m + 200
        m = 10
        n = n + 30
    print ste, sta, inp, act
    canvas.create_text(65, 110, text="S.N.", font="Times 15 bold")
    canvas.create_text(285, 110, text="Stack", font="Times 15 bold")
    canvas.create_text(475, 110, text="Input", font="Times 15 bold")
    canvas.create_text(665, 110, text="Action", font="Times 15 bold")

    show.geometry("%dx%d%+d%+d" % (1300, 800, 0, 0))
Exemplo n.º 50
0
    def help_f(self):
		top = Toplevel()
		top.title("HELP")
		msg = Message(top, width= 500,
             text="COEFF Calibration Procedure: \n \
             Input Start Point and Length of the pulse \n \
             Input an initial guess of the pulse amplitude \n \
             Use a ROI with at least 1000 samples of baseline \n \
             and 1000 samples after pulse end \n \
             Adjust loop range and step until a graph error \n \
             with a minimum is observed \n \
             Refine the search to increase precision")
		msg.pack()

		button = Button(top, text="Close", command=top.destroy)
		button.pack()
Exemplo n.º 51
0
 def __init__(self, parent, title, display_it):
     self.display_it = display_it
     self.errors = 0
     self.warnings = 0
     if self.display_it is False:
         return
     top = Toplevel()
     top.title(title)
     scrollbar = Scrollbar(top, orient=VERTICAL)
     self.textb = Text(top, width=80, height=40, wrap="word", font="arial 11", padx=5, yscrollcommand=scrollbar.set)
     scrollbar.config(command=self.textb.yview)
     scrollbar.pack(side=RIGHT, fill=Y)
     self.textb.pack(side=LEFT, fill=BOTH, expand=1)
     self.textb.config(state=NORMAL)
     self.textb.delete(1.0, END)
     self.textb.config(state=DISABLED)
Exemplo n.º 52
0
def getDlg(root, title):
    """Create a dialog
    
    Arguments
    root -- dialog parent
    title -- dialog title
    
    """
    dlg = Toplevel(root)
    dlg.title(title)
    dlg.root = root
    
    dlg.grab_set()
    dlg.transient(root)
    dlg.resizable(False, False)
    return dlg
Exemplo n.º 53
0
    def f(event):
        def dest(event):
            w.destroy()

        w = Toplevel()
        w.title(title)
        w.config(bg=Styles.colours["grey"], padx=20, pady=20)

        h = header(w, title)
        t = Text(w, width=30, height=height, relief=FLAT, bg=Styles.colours["grey"], wrap=WORD,
                 font=Styles.fonts["entryFilled"])
        t.insert(END, text)
        b = yellowbutton(w, "OK", 20, dest)
        h.grid(row=0, column=0)
        t.grid(row=1, column=0)
        b.grid(row=2, column=0)
Exemplo n.º 54
0
def _color_delegator(parent):  # htest #
    from Tkinter import Toplevel, Text
    from idlelib.Percolator import Percolator

    top = Toplevel(parent)
    top.title("Test ColorDelegator")
    top.geometry("200x100+%d+%d" % (parent.winfo_rootx() + 200,
                  parent.winfo_rooty() + 150))
    source = "if somename: x = 'abc' # comment\nprint\n"
    text = Text(top, background="white")
    text.pack(expand=1, fill="both")
    text.insert("insert", source)
    text.focus_set()

    p = Percolator(text)
    d = ColorDelegator()
    p.insertfilter(d)
Exemplo n.º 55
0
    def help_f(self):
        top = Toplevel()
        top.title("HELP")
        msg = Message(top,
                      width=500,
                      text="COEFF Calibration Procedure: \n \
             Input Start Point and Length of the pulse \n \
             Input an initial guess of the pulse amplitude \n \
             Use a ROI with at least 1000 samples of baseline \n \
             and 1000 samples after pulse end \n \
             Adjust loop range and step until a graph error \n \
             with a minimum is observed \n \
             Refine the search to increase precision")
        msg.pack()

        button = Button(top, text="Close", command=top.destroy)
        button.pack()
Exemplo n.º 56
0
def _dyn_option_menu(parent):  # htest #
    from Tkinter import Toplevel

    top = Toplevel()
    top.title("Tets dynamic option menu")
    top.geometry("200x100+%d+%d" % (parent.winfo_rootx() + 200,
                  parent.winfo_rooty() + 150))
    top.focus_set()

    var = StringVar(top)
    var.set("Old option set") #Set the default value
    dyn = DynOptionMenu(top,var, "old1","old2","old3","old4")
    dyn.pack()

    def update():
        dyn.SetMenu(["new1","new2","new3","new4"], value="new option set")
    button = Button(top, text="Change option set", command=update)
    button.pack()
Exemplo n.º 57
0
 def SearchGene(self):  #interface for "Select genes for analysis"
     SearchFrame = Toplevel()
     SearchFrame.title(
         "Data entry. Enter gene identifier, probesets or keywords.\n")
     scrollBar = Scrollbar(SearchFrame)
     self.inputFrame = Text(SearchFrame,
                            font="courier",
                            width=30,
                            wrap=WORD)
     self.inputFrame.pack(side=LEFT, fill=BOTH)
     scrollBar.pack(side=LEFT, fill=Y)
     self.inputFrame.config(yscrollcommand=scrollBar.set)
     scrollBar.config(command=self.inputFrame.yview)
     goButton = Button(SearchFrame,
                       text="Find",
                       fg="red",
                       command=self.SearchGenePipe)
     goButton.pack(side=BOTTOM)
Exemplo n.º 58
0
Arquivo: CTA.py Projeto: Panumy/CTA-DB
def edit_admin_username():
    admin = manentry.get()
    sqlq = "SELECT COUNT(1) FROM db_ADMINS WHERE username = '******'" % (admin)
    cursor.execute(sqlq)
    if cursor.fetchone()[0]:
        global uschentry, win2
        win2 = Toplevel(root)
        win2.resizable(width=FALSE, height=FALSE)
        win2.title("Username change")
        uschlabel = Label(win2, text="New username")
        uschentry = Entry(win2)
        uschbutto = Button(win2, text="Change", command=change_username)
        uschlabel.pack()
        uschentry.pack()
        uschbutto.pack()
    else:
        tkMessageBox.showerror("Error", "Invalid username.")
    cnx.commit()