Example #1
0
class gui:
    
    def __init__(self):
        self.tk = Tk()
        self.canvas = Canvas(self.tk)
        self.tk.after_idle(self.test)
        self.tk.mainloop()

    def test(self):
        print 'boom'
        self.tk.after(200, self.test2)

    def test2(self):
        print 'bang'
        self.tk.after(200, self.test)
Example #2
0
def guiLogin():
    root = Tk()

    root.title("Enter Lastpass login")

    mainframe = ttk.Frame(root, padding="3 3 12 12")
    mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
    mainframe.columnconfigure(0, weight=1)
    mainframe.rowconfigure(0, weight=1)

    username = StringVar()
    password = StringVar()
    ret = []

    def done(*args):
        ret.append((username.get(), password.get()))
        root.destroy()

    ttk.Label(mainframe, text="Username:"******"Password:"******"Login", command=done).grid(column=2,
                                                           row=3,
                                                           sticky=W)

    for child in mainframe.winfo_children():
        child.grid_configure(padx=5, pady=2)

    username_entry.focus()
    root.bind('<Return>', done)
    root.bind('<Escape>', lambda event: root.destroy())

    root.lift()
    root.call('wm', 'attributes', '.', '-topmost', True)
    root.after_idle(root.call, 'wm', 'attributes', '.', '-topmost', False)

    root.mainloop()

    return ret and ret[-1] or None
Example #3
0
File: gui.py Project: Bromind/yaomr
        self.midi_check.select()
        self.file_label.grid(row=1, column=2, sticky=W)
        self.folder_label.grid(row=2, column=2, sticky=W)
        self.file_button.grid(row=1, column=1, sticky=W)
        self.folder_button.grid(row=2, column=1, sticky=W)
        self.gen_button.grid(row=3, column=1)
        self.exit_button.grid(row=3, column=2)
        self.build_check.grid(row=4, column=1)
        self.midi_check.grid(row=4, column=2)

    def pick_file(self):
        param.infile = tkFileDialog.askopenfilename(
            initialdir=".",
            title="Select scores",
            filetypes=(("png files", "*.png"), ("all files", "*.*")))
        self.file_text.set(param.infile)

    def pick_folder(self):
        param.outdir = tkFileDialog.askdirectory(initialdir=".")
        self.folder_text.set(param.outdir)


root = Tk()
root.geometry("600x120")
root.eval('tk::PlaceWindow %s center' % root.winfo_pathname(root.winfo_id()))
my_gui = MainGui(root)
root.lift()
root.attributes('-topmost', True)
root.after_idle(root.attributes, '-topmost', False)
root.mainloop()
Example #4
0
         total, lags, visibility, phase_fit, m, c) = correlator.get_correlation()
        baseline = left, right
        logger.debug('received baseline %s' % repr(baseline))
    except NoCorrelations:
        widget.after(1, update_plots, widget, baselines)
        return # it never comes to this
    if baseline not in baselines.keys():
        corr.axes.grid()
        #corr.axes.set_xlabel('Lag', size='large')
        #corr.axes.set_ylabel('Correlation Function', size='large')
        phase_line = corr.plot(f, angle(visibility), '%so' % colors[current%len(colors)], linewidth=1, label=repr(baseline))[0]
        fit_line = corr.plot(f, real(phase_fit), '%s-' % colors[current%len(colors)], linewidth=1, label=None)[0]
        baselines[baseline] = phase_line, fit_line
    else:
        corr.axes.legend()
        phase_line, fit_line = baselines[baseline]
        corr.update_line(phase_line, f, angle(visibility))
        corr.update_line(fit_line, f, real(phase_fit))
    if current == total-1:
        widget.update()
        logger.info('update in')
    widget.after_idle(update_plots, widget, baselines)


root.update()
root.geometry(frame.winfo_geometry())
root.after_idle(update_plots, root, {})

root.deiconify()
root.mainloop()
Example #5
-1
def guiLogin(title, default_username="", default_password=""):
    from Tkinter import Tk, N, S, W, E, StringVar
    import ttk

    root = Tk()

    root.title(title)

    mainframe = ttk.Frame(root, padding="3 3 12 12")
    mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
    mainframe.columnconfigure(0, weight=1)
    mainframe.rowconfigure(0, weight=1)

    username = StringVar()
    username.set(default_username)
    password = StringVar()
    password.set(default_password)

    def done(*args):
        root.destroy()

    ttk.Label(mainframe, text="Username:"******"Password:"******"*")
    pass_entry.grid(column=2, row=2, sticky=(W, E))

    ttk.Button(mainframe, text="Login", command=done).grid(column=2, row=3, sticky=W)

    for child in mainframe.winfo_children(): child.grid_configure(padx=5, pady=2)

    username_entry.focus()
    root.bind('<Return>', done)
    root.bind('<Escape>', lambda event: root.destroy())

    root.lift()
    root.call('wm', 'attributes', '.', '-topmost', True)
    root.after_idle(root.call, 'wm', 'attributes', '.', '-topmost', False)

    root.mainloop()

    return username.get(), password.get()
Example #6
-1
def guiLogin():
    root = Tk()

    root.title("Enter Lastpass login")

    mainframe = ttk.Frame(root, padding="3 3 12 12")
    mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
    mainframe.columnconfigure(0, weight=1)
    mainframe.rowconfigure(0, weight=1)

    username = StringVar()
    password = StringVar()
    ret = []

    def done(*args):
        ret.append((username.get(), password.get()))
        root.destroy()

    ttk.Label(mainframe, text="Username:"******"Password:"******"Login", command=done).grid(column=2, row=3, sticky=W)

    for child in mainframe.winfo_children(): child.grid_configure(padx=5, pady=2)

    username_entry.focus()
    root.bind('<Return>', done)
    root.bind('<Escape>', lambda event: root.destroy())

    root.lift()
    root.call('wm', 'attributes', '.', '-topmost', True)
    root.after_idle(root.call, 'wm', 'attributes', '.', '-topmost', False)

    root.mainloop()

    return ret and ret[-1] or None