def __init__(self, parent, filename, title): Toplevel.__init__(self, parent) self.wm_title(title) self.protocol("WM_DELETE_WINDOW", self.destroy) HelpFrame(self, filename).grid(column=0, row=0, sticky='nsew') self.grid_columnconfigure(0, weight=1) self.grid_rowconfigure(0, weight=1)
def __init__(self, teamnum, teams, alliances, scores): Toplevel.__init__(self) self.title(string = "%s" % titlestring) self.teamnum = int(teamnum) self.teamnumber = teams[self.teamnum] self.score = scores[self.teamnum] self.elements = { # motoma! 'teamnumber':IntVar(), 'prescore':IntVar(), } self.elements['teamnumber'].set(self.teamnumber) self.elements['prescore'].set(self.score) # Starting our editing frame ef = LabelFrame(self, text = "Edit Team Information", relief=GROOVE, labelanchor="nw", width = 400, height = 150) ef.grid(row = 0, column = 0) ef.grid_propagate(0) Label(ef, text = "Team Number:").grid(row = 0, column = 1) Entry(ef, text = "%s" % self.teamnumber, textvar = self.elements['teamnumber']).grid(row = 0, column = 2) Label(ef, text = "Pre-Round Score:").grid(row = 1, column = 1) Entry(ef, text = "%s" % self.score, textvar = self.elements['prescore']).grid(row = 1, column = 2) Label(ef, text = "").grid(row = 2, column = 1) Button(ef, text = "Submit", command=self.submitchanges).grid(row = 3, column = 2)
def __init__(self, parent, title, message, usedNames): """ message - string, informational message to display usedNames - list, list of names already in use for validity check """ Toplevel.__init__(self, parent) self.configure(borderwidth=5) self.resizable(height=False, width=False) self.title(title) self.transient(parent) self.grab_set() self.protocol("WM_DELETE_WINDOW", self.Cancel) self.parent = parent self.message = message self.usedNames = usedNames self.result = '' self.CreateWidgets() self.withdraw() #hide while setting geometry self.update_idletasks() self.geometry("+%d+%d" % ((parent.winfo_rootx() + ((parent.winfo_width() / 2) - (self.winfo_reqwidth() / 2)), parent.winfo_rooty() + ((parent.winfo_height() / 2) - (self.winfo_reqheight() / 2)) )) ) #centre dialog over parent self.deiconify() #geometry set, unhide self.wait_window()
def __init__(self, parent, title, message, used_names, _htest=False): """ message - string, informational message to display used_names - string collection, names already in use for validity check _htest - bool, change box location when running htest """ Toplevel.__init__(self, parent) self.configure(borderwidth=5) self.resizable(height=FALSE, width=FALSE) self.title(title) self.transient(parent) self.grab_set() self.protocol("WM_DELETE_WINDOW", self.Cancel) self.parent = parent self.message = message self.used_names = used_names self.create_widgets() self.withdraw() #hide while setting geometry self.update_idletasks() #needs to be done here so that the winfo_reqwidth is valid self.messageInfo.config(width=self.frameMain.winfo_reqwidth()) self.geometry("+%d+%d" % (parent.winfo_rootx() + (parent.winfo_width() / 2 - self.winfo_reqwidth() / 2), parent.winfo_rooty() + ((parent.winfo_height() / 2 - self.winfo_reqheight() / 2) if not _htest else 100)) ) #centre dialog over parent (or below htest box) self.deiconify() #geometry set, unhide self.wait_window()
def __init__(self, parent, title, message, used_names, _htest=False): """ message - string, informational message to display used_names - string collection, names already in use for validity check _htest - bool, change box location when running htest """ Toplevel.__init__(self, parent) self.configure(borderwidth=5) self.resizable(height=FALSE, width=FALSE) self.title(title) self.transient(parent) self.grab_set() self.protocol("WM_DELETE_WINDOW", self.Cancel) self.parent = parent self.message = message self.used_names = used_names self.create_widgets() self.withdraw() #hide while setting geometry self.update_idletasks() #needs to be done here so that the winfo_reqwidth is valid self.messageInfo.config(width=self.frameMain.winfo_reqwidth()) self.geometry( "+%d+%d" % ( parent.winfo_rootx() + (parent.winfo_width()/2 - self.winfo_reqwidth()/2), parent.winfo_rooty() + ((parent.winfo_height()/2 - self.winfo_reqheight()/2) if not _htest else 100) ) ) #centre dialog over parent (or below htest box) self.deiconify() #geometry set, unhide self.wait_window()
def __init__(self, parent): Toplevel.__init__(self, parent) self.resizable(width=False, height=False) self.wm_title("Setting") #1: Create a builder self.builder = builder = pygubu.Builder() #2: Load an ui file builder.add_from_file(PoResources.OPTION_DEF) #3: Set images path before creating any widget img_path = os.getcwd() + "/img" img_path = os.path.abspath(img_path) builder.add_resource_path(img_path) #4: Create the widget using a master as parent self.mainwindow = builder.get_object('option_frame', self) builder.import_variables(self) self.settings = Settings() self.load_config() # Connect method callbacks builder.connect_callbacks(self)
def __init__(self, parent, title, menuItem='', filePath=''): """Get menu entry and url/ local file location for Additional Help User selects a name for the Help resource and provides a web url or a local file as its source. The user can enter a url or browse for the file. """ Toplevel.__init__(self, parent) self.configure(borderwidth=5) self.resizable(height=False, width=False) self.title(title) self.transient(parent) self.grab_set() self.protocol("WM_DELETE_WINDOW", self.Cancel) self.parent = parent self.result = None self.CreateWidgets() self.menu.set(menuItem) self.path.set(filePath) self.withdraw() #hide while setting geometry #needs to be done here so that the winfo_reqwidth is valid self.update_idletasks() #centre dialog over parent: self.geometry("+%d+%d" % ((parent.winfo_rootx() + ((parent.winfo_width()/2) -(self.winfo_reqwidth()/2)), parent.winfo_rooty() + ((parent.winfo_height()/2) -(self.winfo_reqheight()/2))))) self.deiconify() #geometry set, unhide self.bind('<Return>', self.Ok) self.wait_window()
def __init__(self, master, mixer): Toplevel.__init__(self, master, width=400) mixer_frame = MixerFrame(self, mixer) mixer_frame.grid(row=0, column=0, sticky='nwes') self.grid_columnconfigure(0, weight=1) self.grid_rowconfigure(0, weight=1)
def __init__(self, message, value=None): self._prevent_execution_with_timeouts() Toplevel.__init__(self, self._get_parent()) self._init_dialog() self._create_body(message, value) self._create_buttons() self._result = None
def __init__(self, root, shape): """ Initialize root tkinter window and master GUI window """ Toplevel.__init__(self, root, width=200, height=200) self.__shape = shape if shape is False: self.close() return self.title('Edit Attributes') # copies TAGS to avoid aliasing self.__available_attributes = TAGS[:] self.container = Frame(self) self.container.pack(side=TOP, fill=BOTH, expand=True) self.top_frame = None self.bottom_frame = None self.note_text = None self.attributes_list = None self.selected_list = None self.transient(root) logger.info('Creating top frame') self.create_top_frame() logger.info('Creating bottom frame') self.create_bottom_frame()
def __init__(self, parent, objectList): Toplevel.__init__(self, parent) self.protocol('WM_DELETE_WINDOW', self.destroy) self._objectList = objectList self._lb = Listbox(self, selectmode = SINGLE) self._lb.pack() self._buttons = PanedWindow(self) for i in objectList.getKeysInOrder(): self._lb.insert(END, i) addButton = Button(self._buttons, text="Add", command=self.onAdd) addButton.pack(side=LEFT) modifyButton = Button(self._buttons, text="Modify", command=self.onModify) modifyButton.pack(side=LEFT) deleteButton = Button(self._buttons, text="Delete", command=self.onDelete) deleteButton.pack(side=LEFT) cancelButton = Button(self._buttons, text="Cancel", command=self.onCancel) cancelButton.pack(side=RIGHT) self._buttons.pack(side=BOTTOM)
def __init__(self, master, app): Toplevel.__init__(self, master) self.config(background=factory.bg()) config = app.config id_ = config["global-osc-id"] host, port = config['host'], config['port'] client, cport = config['client'], config['client_port'] midi_receiver = app.midi_receiver.port_name() midi_transmitter = "n/a" # FIX ME main = VFrame(self) main.pack(anchor="nw", expand=True, fill=BOTH) image = Image.open("resources/logos/llia_logo_medium.png") photo = ImageTk.PhotoImage(image) lab_logo = Label(main, image=photo) main.add(lab_logo) south = factory.frame(main) main.add(south) acc = "Llia Version %s.%s.%s \n" % VERSION[0:3] acc += "(c) 2016 Steven Jones\n\n" acc += "OSC ID : %s\n" % id_ acc += "OSC Host : %-12s port : %s\n" % (host, port) acc += "OSC client : %-12s port : %s\n\n" % (client, cport) acc += "MIDI Receiver : %s\n" % midi_receiver acc += "MIDI Transmitter : %s\n" % midi_transmitter tx = factory.read_only_text(south, acc) tx.pack(pady=32) self.grab_set() self.mainloop()
def __init__(self, master, customers, payments, refresh): Toplevel.__init__(self,master) self.root = master self.refresh = refresh self.title("Check In") self.iconname = "Check In" self.name = StringVar() # variable for customer self.customers = customers # customers object self.payments = payments self.names = [] self.workout = StringVar() self.workouts = [] self.workouts_form = [] self.date = StringVar() self.date.set(strftime("%m/%d/%Y")) self.refresh_time = 15 # in minutes self.output = '' # for the output label at the bottom self.schedule = Schedule() self.logger = Logger() #throws IOError if file is open inf = Frame(self) inf.pack(padx=10,pady=10,side='top') Label(inf, text="Name:").grid(row=0,column=0,sticky=E,ipady=2,pady=2,padx=10) Label(inf, text='Date:').grid(row=1,column=0,sticky=E,ipady=2,pady=2,padx=10) Label(inf, text="Workout:").grid(row=2,column=0,sticky=E,ipady=2,pady=2,padx=10) self.name_cb = Combobox(inf, textvariable=self.name, width=30, values=self.names) self.name_cb.grid(row=0,column=1,sticky=W,columnspan=2) self.date_ent = Entry(inf, textvariable=self.date) self.date_ent.grid(row=1,column=1,sticky=W) self.date_ent.bind('<FocusOut>', self.update_workouts) Button(inf,text='Edit', command=self.enable_date_ent).grid(row=1,column=2,sticky=E) self.workout_cb = Combobox(inf, textvariable=self.workout, width=30, values=self.workouts_form,state='readonly') self.workout_cb.grid(row=2,column=1,sticky=W,columnspan=2) self.log_btn=Button(inf,text="Log Workout",command=self.log,width=12) self.log_btn.grid(row=3,column=1,columnspan=2,pady=4,sticky='ew') stf = Frame(self) stf.pack(padx=10,pady=10,fill='x',side='top') self.scrolled_text = ScrolledText(stf,height=15,width=50,wrap='word',state='disabled') self.scrolled_text.pack(expand=True,fill='both') self.update_workouts() self.update_names() self.bind('<Return>',self.log) self.name_cb.focus_set() # set the focus here when created #disable the date field self.disable_date_ent() #start time caller self.time_caller()
def __init__(self, parent, title, text, modal=True, _htest=False): """Show the given text in a scrollable window with a 'close' button If modal option set to False, user can interact with other windows, otherwise they will be unable to interact with other windows until the textview window is closed. _htest - bool; change box location when running htest. """ Toplevel.__init__(self, parent) self.configure(borderwidth=5) # place dialog below parent if running htest self.geometry("=%dx%d+%d+%d" % (750, 500, parent.winfo_rootx() + 10, parent.winfo_rooty() + (10 if not _htest else 100))) #elguavas - config placeholders til config stuff completed self.bg = '#ffffff' self.fg = '#000000' self.CreateWidgets() self.title(title) self.protocol("WM_DELETE_WINDOW", self.Ok) self.parent = parent self.textView.focus_set() #key bindings for this dialog self.bind('<Return>',self.Ok) #dismiss dialog self.bind('<Escape>',self.Ok) #dismiss dialog self.textView.insert(0.0, text) self.textView.config(state=DISABLED) if modal: self.transient(parent) self.grab_set() self.wait_window()
def __init__(self, master, title, text): Toplevel.__init__(self, master=master) self.title(title) fra = Frame(self) fra.grid(row=0, column=0, pady=5, padx=5) self.tx = Text(fra, width=130, height=20, wrap=WORD) scr = Scrollbar(fra, command=self.tx.yview) self.tx.configure(yscrollcommand=scr.set) self.tx.pack(side=LEFT) scr.pack(side=RIGHT, fill=Y) self.tx.bind('<Enter>', lambda e: self._bound_to_mousewheel(e, self.tx)) self.tx.bind('<Leave>', self._unbound_to_mousewheel) self.tx.insert(END, text) self.tx.configure(state='disabled') if platform == "darwin": button_font = Font(family='Arial', size=15) else: button_font = Font(font=Button()["font"]) closeTopolPrevB = Button(self, text='Exit', bg='red', command=self.destroy, font=button_font) closeTopolPrevB.grid(row=1, column=0, pady=5)
def __init__( self ): """ Initialize window settings """ Toplevel.__init__( self ) self.title( "Help" ) self.iconbitmap( ICON_FILENAME ) self.geometry( "+100+50" ) help_list = { "0-9": "Save Image", "<-": "Prev", "->": "Next", "g": "Grayscale", "m": "Mirror", "i": "Invert", "b": "Blur", "c": "Contour", "d": "Detail", "e": "Edge Enhance", "Shift e": "Edge Enhance More", "o": "Emboss", "h": "Find Edges", "s": "Smooth", "Shift s": "Smooth More", "p": "Sharpen", "Shift c": "Clear All Effects", } CTRL_hl = { "CTRL <-": "Rotate CCW", "CTRL ->": "Rotate CW", "CTRL q": "Exit", "CTRL t": "Toss" } i = 0 for item in help_list: Label( self, text=help_list[ item ] ).grid( row=i, column=0, sticky="W" ) Label( self, text=item ).grid( row=i, column=1, sticky="W" ) i += 1 Label( self, text="----------------------------" ).grid( row=i, column=0, columnspan=2 ) i += 1 for item in CTRL_hl: Label( self, text=CTRL_hl[ item ] ).grid( row=i, column=0, sticky="W" ) Label( self, text=item ).grid( row=i, column=1, sticky="W" ) i += 1 Button( self, text="Ok", command=self.quit, width=7 ).grid( row=i, columnspan=2 ) self.mainloop() self.destroy()
def __init__(self, parent, process, x, y): Toplevel.__init__(self, parent) self.wm_overrideredirect(True) self.wm_geometry("+%d+%d" % (x+25,y+20)) label = Label(self, text="", justify='left', background='white', relief='solid', borderwidth=1, font=("times", "12", "normal")) label.pack(ipadx=20) tree = Treeview(label) tree["columns"] = ("value") tree.column("#0", minwidth=0, width=100) tree.column("#1", minwidth=0, width=100) tree.heading("#0", text="Name") tree.heading("#1", text="Value") for A, state in process.state.items(): if isinstance(A, Algorithm): tree.insert("", 0, iid=A, text=str(A), values=("",)) for key, val in state.items(): tree.insert(A, 0, text=key, values=(val,)) for key, val in process.state.items(): if not isinstance(key, Algorithm): tree.insert("", 0, text=key, values=(val,)) tree.insert("", 0, text="UID", values=(process.UID,)) tree.pack()
def __init__(self, parent, title, menuItem='', filePath='', _htest=False): """Get menu entry and url/ local file location for Additional Help User selects a name for the Help resource and provides a web url or a local file as its source. The user can enter a url or browse for the file. _htest - bool, change box location when running htest """ Toplevel.__init__(self, parent) self.configure(borderwidth=5) self.resizable(height=FALSE, width=FALSE) self.title(title) self.transient(parent) self.grab_set() self.protocol("WM_DELETE_WINDOW", self.Cancel) self.parent = parent self.result = None self.CreateWidgets() self.menu.set(menuItem) self.path.set(filePath) self.withdraw() #hide while setting geometry #needs to be done here so that the winfo_reqwidth is valid self.update_idletasks() #centre dialog over parent. below parent if running htest. self.geometry("+%d+%d" % (parent.winfo_rootx() + (parent.winfo_width() / 2 - self.winfo_reqwidth() / 2), parent.winfo_rooty() + ((parent.winfo_height() / 2 - self.winfo_reqheight() / 2) if not _htest else 150))) self.deiconify() #geometry set, unhide self.bind('<Return>', self.Ok) self.wait_window()
def __init__(self, master, title, prompt, x_name, y_name, var_type, x_default, y_default, *args, **kwargs): Toplevel.__init__(self, master, *args, **kwargs) self.title(title) #TODO: Can this be done in a smarter manner? self._x_var = var_type(self) self._y_var = var_type(self) self._x_var.set(x_default) self._y_var.set(y_default) self.canceled = True self.prompt_label = Label(self, text=prompt) self.prompt_label.grid(row=0, column=0, columnspan=2, pady=2) self.x_label = Label(self, text="{}:".format(x_name)) self.x_input = Entry(self, textvariable=self._x_var) self.y_label = Label(self, text="{}:".format(y_name)) self.y_input = Entry(self, textvariable=self._y_var) self.x_label.grid(row=1, column=0, pady=2) self.x_input.grid(row=1, column=1, pady=2) self.y_label.grid(row=2, column=0, pady=2) self.y_input.grid(row=2, column=1, pady=2) self.ok_button = Button(self, text="OK", command=self.ok, width=self.BUTTON_WIDTH) self.cancel_button = Button(self, text="Cancel", command=self.cancel, width=self.BUTTON_WIDTH) self.ok_button.grid(row=3, column=0, sticky="NS", padx=5, pady=2) self.cancel_button.grid(row=3, column=1, sticky="NS", padx=5, pady=2)
def __init__(self, message, *args): self._prevent_execution_with_timeouts() Toplevel.__init__(self, self._get_parent()) self._init_dialog() self._create_body(message, args) self._create_buttons() self.wait_window(self)
def __init__(self, wdgt, delay=1, follow=True): """ Initialize the ToolTip Arguments: wdgt: The widget this ToolTip is assigned to msg: A static string message assigned to the ToolTip msgFunc: A function that retrieves a string to use as the ToolTip text delay: The delay in seconds before the ToolTip appears(may be float) follow: If True, the ToolTip follows motion, otherwise hides """ self.wdgt = wdgt # The parent of the ToolTip is the parent of the ToolTips widget self.parent = self.wdgt.master # Initalise the Toplevel Toplevel.__init__(self, self.parent, bg='black', padx=1, pady=1) # Hide initially self.withdraw() # The ToolTip Toplevel should have no frame or title bar self.overrideredirect(True) # The msgVar will contain the text displayed by the ToolTip self.msgVar = StringVar() self.delay = delay self.follow = follow self.visible = 0 self.lastMotion = 0 Message(self, textvariable=self.msgVar, bg='#FFFFDD', aspect=1000).grid() # The test of the ToolTip is displayed in a Message widget
def __init__(self, master, splash=True): Toplevel.__init__(self, master) self.title('MSTM - splash') ws = self.master.winfo_screenwidth() hs = self.master.winfo_screenheight() w = 400 h = 225 x = (ws / 2) - (w / 2) y = (hs / 2) - (h / 2) self.geometry('%dx%d+%d+%d' % (w, h, x, y)) try: self.splash_image = ImageTk.PhotoImage( Image.open(os.path.join('images', 'splash.png'))) except Exception as err: print('Can not load splash image\n%s' % err) self.label = ttk.Label(self, image=self.splash_image) self.label.place(x=0, y=0, width=w, height=h) self.entry = ttk.Entry(self) self.entry.insert(0, 'https://github.com/lavakyan/mstm-spectrum') self.entry.configure(state='readonly') self.entry.place(x=5, rely=0.9, width=w - 10) if splash: self.overrideredirect(True) # do magic # required to make window show before the program gets to the mainloop self.update() else: self.protocol('WM_DELETE_WINDOW', self.del_window) self.label.bind('<Button-1>', self.del_window) self.label.bind('<Button-2>', self.del_window)
def __init__(self, parent): Toplevel.__init__(self) img = ImageTk.PhotoImage(file=os.path.join(os.path.dirname(__file__), 'Icons/LMS8001_PLLSim.png')) self.tk.call('wm', 'iconphoto', self._w, img) self.parent = parent if (sys.platform == 'win32'): font_paths = matplotlib.font_manager.win32InstalledFonts( fontext='ttf') self.font_names = [] for font_path in font_paths: font_inst = matplotlib.ft2font.FT2Font(font_path) font_prop = matplotlib.font_manager.ttfFontProperty(font_inst) self.font_names.append(font_prop.name) elif (sys.platform == 'linux2'): font_list = matplotlib.font_manager.get_fontconfig_fonts() self.font_names = [ matplotlib.font_manager.FontProperties(fname=fname).get_name() for fname in font_list ] else: print 'Unsupported OS type. Exiting Preferences Window.' tkMessageBox.showinfo('Unsupported OS type', 'Exiting Preferences Window') self.destroy() self.initUI() center_Window(self) self.protocol("WM_DELETE_WINDOW", self.on_Quit)
def __init__(self, area, *args, **kwargs): Toplevel.__init__(self, area, *args, **kwargs) self.area = area self.wm_overrideredirect(1) self.wm_geometry("+10000+10000") self.bind('<Configure>', lambda event: self.update()) self.update()
def __init__(self, app): self.app = app Toplevel.__init__(self, app) self.title("Reset Usage Counters") self.protocol("WM_DELETE_WINDOW", self.doCancel) f = Frame(self) f.pack() self.cbDL = {} for d in DLLIST: cbv = IntVar() t = "%s(%s)" % (DLNAMES[d], self.app.dataLoggers[d].getToNowStr()) cb = Checkbutton(f, text=t, variable=cbv) self.cbDL[d] = cbv cb.pack(anchor=W, padx=10) f = Frame(self) f.pack() self.bOK = Button(f, text="OK", width=12, command=self.doOK) self.bOK.pack(side=LEFT, padx=2, pady=5) self.bCancel = Button(f, text="Cancel", width=12, command=self.doCancel) self.bCancel.pack(side=LEFT, padx=2, pady=5)
def __init__(self, parent, title=None): Toplevel.__init__(self, parent) self.transient(parent) if title: self.title(title) self.parent = parent self.result = None body = Frame(self) self.initial_focus = self.body(body) body.pack(padx=5, pady=5) self.buttonbox() self.grab_set() if not self.initial_focus: self.initial_focus = self self.protocol("WM_DELETE_WINDOW", self.cancel) self.geometry("+%d+%d" % (parent.winfo_rootx()+50, parent.winfo_rooty()+50)) self.initial_focus.focus_set() self.wait_window(self)
def __init__(self, parent, title, text): """Show the given text in a scrollable window with a 'close' button """ Toplevel.__init__(self, parent) self.configure(borderwidth=5) self.geometry("=%dx%d+%d+%d" % (625, 500, parent.winfo_rootx() + 10, parent.winfo_rooty() + 10)) #elguavas - config placeholders til config stuff completed self.bg = '#ffffff' self.fg = '#000000' self.CreateWidgets() self.title(title) self.transient(parent) self.grab_set() self.protocol("WM_DELETE_WINDOW", self.Ok) self.parent = parent self.textView.focus_set() #key bindings for this dialog self.bind('<Return>',self.Ok) #dismiss dialog self.bind('<Escape>',self.Ok) #dismiss dialog self.textView.insert(0.0, text) self.textView.config(state=DISABLED) self.wait_window()
def __init__(self, parent, title, text): """Show the given text in a scrollable window with a 'close' button """ Toplevel.__init__(self, parent) self.configure(borderwidth=5) self.geometry( "=%dx%d+%d+%d" % (625, 500, parent.winfo_rootx() + 10, parent.winfo_rooty() + 10)) #elguavas - config placeholders til config stuff completed self.bg = '#ffffff' self.fg = '#000000' self.CreateWidgets() self.title(title) self.transient(parent) self.grab_set() self.protocol("WM_DELETE_WINDOW", self.Ok) self.parent = parent self.textView.focus_set() #key bindings for this dialog self.bind('<Return>', self.Ok) #dismiss dialog self.bind('<Escape>', self.Ok) #dismiss dialog self.textView.insert(0.0, text) self.textView.config(state=DISABLED) self.wait_window()
def __init__(self, root, prtr, settings, log, *arg): Toplevel.__init__(self, root, *arg) self.protocol('WM_DELETE_WINDOW', self.delTop) self.title("Macro Buttons") self.app = root self.settings = settings self.printer = prtr self.log = log self.macroList = self.settings.getMacroList() fw = BUTTONWIDTH * 3 fh = BUTTONHEIGHT * 10 self.f = Frame(self, width = BUTTONWIDTH*3, height=BUTTONHEIGHT*10) for m in self.macroList: b = Button(self.f, text=m[MTEXT], width=BWIDTH, command=lambda macro=m[MNAME]: self.doMacro(macro)) x = (m[MCOL]-1) * BUTTONWIDTH y = (m[MROW]-1) * BUTTONHEIGHT b.place(relx=0.0, rely=0.0, y=y, x=x, anchor=NW) self.f.pack() geometry = "%dx%d+50+50" % (fw, fh) self.geometry(geometry)
def __init__(self, master, apply_information, title='申请业务详情'): print 'apply_information', apply_information Toplevel.__init__(self) self.master = master self.apply_information = apply_information self.title(title) self.create_widget() self.pack_all()
def __init__(self, master=None, disable_dragging =False, release_command = None): Toplevel.__init__(self, master) if disable_dragging == False: self.bind('<Button-1>', self.initiate_motion) self.bind('<ButtonRelease-1>', self.release_dragging) self.release_command = release_command
def __init__(self, master, app): Toplevel.__init__(self, master) self.wm_title = "Control Buses" self.app = app self.proxy = app.proxy self.parser = app.ls_parser main = factory.frame(self, modal=True) main.pack(expand=True) lab_title = factory.label(main, "Control Busses", modal=True) frame_list = factory.frame(main, modal=True) frame_list.config(width=248, height=320) frame_list.pack_propagate(False) self.listbox = factory.listbox(frame_list, command=self.select_bus) self.listbox.pack(expand=True, fill=BOTH) sb = factory.scrollbar(main, yclient=self.listbox) lab_name = factory.label(main, "Name", modal=True) lab_channels = factory.label(main, "Channels", modal=True) self._var_name = StringVar() entry_name = factory.entry(main, self._var_name, ttip="Control bus name") #self._var_chancount = StringVar() #spin_chancount = factory.int_spinbox(main, self._var_chancount, 1, 64) self.lab_warning = factory.warning_label(main, modal=True) button_bar = factory.frame(main, modal=True) #b_remove = factory.delete_button(button_bar,ttip="Delete control bus",command=self.remove_bus) b_add = factory.add_button(button_bar, ttip="Add new control bus", command=self.add_bus) #b_refresh = factory.refresh_button(button_bar, ttip="Refresh bus list", command=self.refresh) b_accept = factory.accept_button(button_bar, command=self.accept) b_help = factory.help_button(button_bar, command=self.display_help) lab_title.grid(row=0, column=0, columnspan=6, pady=8) frame_list.grid(row=1, column=0, rowspan=5, columnspan=5, pady=8) sb.grid(row=1, column=4, rowspan=5, sticky=NS, pady=4, padx=4) lab_name.grid(row=6, column=0, sticky=W, padx=4) entry_name.grid(row=6, column=1) lab_channels.grid(row=7, column=0, sticky=W, pady=8, padx=4) #spin_chancount.grid(row=7, column=1) self.lab_warning.grid(row=8, column=0, columnspan=6) button_bar.grid(row=9, column=0, columnspan=6, padx=8, pady=4) #b_remove.grid(row=0, column=0) b_add.grid(row=0, column=1) #b_refresh.grid(row=0, column=2) b_help.grid(row=0, column=3) #factory.label(button_bar, "").grid(row=0, column=4, padx=16) factory.padding_label(button_bar).grid(row=0, column=4, padx=16) b_accept.grid(row=0, column=5) self._current_selection = 0 entry_name.bind('<Down>', self.increment_selection) entry_name.bind('<Up>', self.decrement_selection) entry_name.bind('<Return>', self.add_bus) self.listbox.bind('<Down>', self.increment_selection) self.listbox.bind('<Up>', self.decrement_selection) self.refresh() self.grab_set() self.mainloop()
def __init__(self, parent, addnl=None): Toplevel.__init__(self) self.initial_focus = self self.parent = parent self.addnl = addnl self.body() self.title('popup window') self.protocol("WM_DELETE_WINDOW", self.cancel) self.showWindow()
def __init__(self, parent): Toplevel.__init__(self) img = ImageTk.PhotoImage(file=os.path.join(os.path.dirname(__file__),'Icons/LMS8001_PLLSim.png')) self.tk.call('wm', 'iconphoto', self._w, img) self.parent=parent self.resizable(0,0) self.initUI() center_Window(self) self.protocol("WM_DELETE_WINDOW", self.on_Quit)
def __init__(self, title): parent = Tk() parent.withdraw() Toplevel.__init__(self, parent) self._init_dialog(parent, title) self._create_body() self._create_buttons() self.result = None self._initial_focus.focus_set() self.wait_window(self)
def __init__(self, master=None, disable_dragging=False, release_command=None): Toplevel.__init__(self, master) if disable_dragging == False: self.bind('<Button-1>', self.initiate_motion) self.bind('<ButtonRelease-1>', self.release_dragging) self.release_command = release_command
def __init__(self, sudoku_gui, **kwargs): """Builds and initializes the GUI as a top level UI. First, the TopLevel instance attributes are created, additionally the following instance attributes are created: settings_builder -- Set of methods for building the PAC Sudoku GUI gui -- Instance of the main Sudoku Game GUI. """ Toplevel.__init__(self, sudoku_gui, **kwargs) self.settings_builder = SudokuGUISettingsBuilder(self, sudoku_gui) self.gui = sudoku_gui self._create_widgets()
def __init__(self, parent): Toplevel.__init__(self) self.parent = parent self.row = 0 self.maxsize(650, 850) self.resizable(0,0) self.scroll = Scrollbar(self) self.scroll.pack(side="right", fill="y", expand=True) self.frame = Listbox(self, yscrollcommand=self.scroll.set) self.scroll.config(command=self.frame.yview) self.frame.pack() self.init_ui()
def __init__(self, parent): Toplevel.__init__(self) self.parent = parent self.row = 0 self.maxsize(650, 850) self.resizable(0, 0) self.scroll = Scrollbar(self) self.scroll.pack(side="right", fill="y", expand=True) self.frame = Listbox(self, yscrollcommand=self.scroll.set) self.scroll.config(command=self.frame.yview) self.frame.pack() self.init_ui()
def __init__(self, master, app): Toplevel.__init__(self, master) self.wm_title("Llia Buffers") self.tbl = TkBufferList(self, app) self.tbl.pack(anchor=NW, expand=True, fill=BOTH) button_bar = factory.frame(self) button_bar.pack(side=BOTTOM, anchor=W, expand=True, fill=X) b_refresh = factory.refresh_button(button_bar, command=self.tbl.refresh) b_accept = factory.accept_button(button_bar, command=self.destroy) b_refresh.pack(side=LEFT) b_accept.pack(side=RIGHT) self.grab_set() self.mainloop()
def __init__(self, title='ClsWin'): """ Создаёт окно и скрывает его. :param title: :return: """ self.title_txt = title Toplevel.__init__(self) self.title(self.title_txt) self.state('withdrawn') self.minsize(640, 480) # признак отображённости окна терминала self.win_screen_show = 0
def __init__(self, master, im, gui): try: Toplevel.__init__(self) from PIL import ImageTk Toplevel.__init__(self, master) self.images = [ImageTk.PhotoImage(file=x) for x in im] for image in self.images: self.image_label = Label(self, image=image) self.image_label.pack() except ImportError, e: msg = "Probably you don't have the PIL module but all the data is saved on the output folder. Try again after installing the Python module." gui.textFrame.insert('end', msg) gui.textFrame.yview('end')
def __init__(self, master, title, message): Toplevel.__init__(self, master=master) self.title(title) Label(self, text=message, anchor=W, justify=LEFT).pack(pady=10, padx=10) x = master.winfo_x() + master.winfo_width() // 2 y = master.winfo_y() + master.winfo_height() // 2 self.wm_geometry("+{:d}+{:d}".format(x, y)) self.resizable(False, False) self.transient(master) self.grab_set() self.focus_force() b = Button(self, text="OK", command=self.ok) b.pack(pady=2, padx=5)
def __init__(self, master=None, **kwargs): ''' (under development) Class - done dimensions - done ''' Toplevel.__init__(self, master) briefing = '' entries_txt = [] entries_val = [] title = 'PromptPopUp' width, height = [None, None] if 'briefing' in kwargs.keys(): briefing = kwargs['briefing'] if 'entries_txt' in kwargs.keys(): entries_txt = kwargs['entries_txt'] if 'entries_val' in kwargs.keys(): entries_val = kwargs['entries_val'] if 'title' in kwargs.keys(): title = kwargs['title'] if 'width' in kwargs.keys(): width = kwargs['width'] if 'height' in kwargs.keys(): height = kwargs['height'] self.master = master self._briefing_ = briefing self._entries_ = entries_txt self._defvals_ = entries_val self._width_ = width self._height_ = height self.set_self_vertex() self.wm_title(' ' * 5 + title) #print self._vertex_ self.geometry('{:d}x{:d}+{:d}+{:d}'.format(*self._vertex_)) self.ent_c = [] if 'content' in kwargs.keys() and not kwargs['content']: pass else: self.create_content() self.grab_set() # when you show the popup self.bind('<Return>', self.save_it)
def __init__(self, canvas, parent, root): Toplevel.__init__(self, root) # Images required by buttons self.edit_img = ImageTk.PhotoImage(file=PATH + '/ico/edit.png') self.prop_img = ImageTk.PhotoImage(file=PATH + '/ico/cog.png') self.plot_img = ImageTk.PhotoImage(file=PATH + '/ico/hide.png') self.outline_img = ImageTk.PhotoImage(file=PATH + '/ico/focus.png') self.paint_img = ImageTk.PhotoImage(file=PATH + '/ico/paint.png') self.erase_img = ImageTk.PhotoImage(file=PATH + '/ico/eraser.png') self.drag_img = ImageTk.PhotoImage(file=PATH + '/ico/cursorhand.png') self.plot_cursor_img = ImageTk.PhotoImage(file=PATH + '/ico/plotcursor.png') self.free_draw_img = ImageTk.PhotoImage(file=PATH + '/ico/freedraw.png') self.polygon_img = ImageTk.PhotoImage(file=PATH + '/ico/polygon.png') self.redo_img = ImageTk.PhotoImage(file=PATH + '/ico/forward.png') self.undo_img = ImageTk.PhotoImage(file=PATH + '/ico/back.png') self.magnify_draw_img = ImageTk.PhotoImage(file=PATH + '/ico/magnify.png') self.extract_img = ImageTk.PhotoImage(file=PATH + '/ico/extract.png') self.home_img = ImageTk.PhotoImage(file=PATH + '/ico/home.png') self.select_cursor = ImageTk.PhotoImage(file=PATH + '/ico/cursorhighlight.png') self.__parent = parent self.__root = root self.__canvas = canvas self.plot_type = IntVar() self.width = parent.width self.height = parent.height self.title('Tools') self.resizable(width=FALSE, height=FALSE) self.protocol('WM_DELETE_WINDOW', ToolsWindow.ignore) self.container = Frame(self) self.container.pack(side=TOP, fill=BOTH, expand=True) self.coordinate_frame = Frame(self.container, width=50, height=50) self.coordinate_frame.config(highlightthickness=1) self.coordinate_frame.config(highlightbackground='grey') self.coordinate_frame.pack(side=BOTTOM, fill=BOTH, expand=False) self.upper_button_frame = None self.upper_range_frame = None self.lower_button_frame = None self.begin_range_entry = None self.begin_alt_range_entry = None self.end_range_entry = None self.end_alt_range_entry = None
def __init__(self, app, root, name=""): Toplevel.__init__(self, root) self.root = root main = factory.frame(self) main.pack(expand=True, fill="both") self.app = app if not name: name = "Group_%d" % self.instance_counter self.name = str(name) GroupWindow.instance_counter += 1 self.notebook = factory.notebook(main) self.notebook.pack(expand=True, fill="both") self.protocol("WM_DELETE_WINDOW", self.on_closing) self.bind("<Destroy>", self.on_closing) self.withdraw() # hide initially
def __init__(self, callback, referenced=None, initialUser="******", initialPassword="******", initialHostname="localhost", initialService="", initialPortno=pb.portno): Toplevel.__init__(self) version_label = Label(self, text="Twisted v%s" % copyright.version) self.pbReferenceable = referenced self.pbCallback = callback # version_label.show() self.username = Entry(self) self.password = Entry(self, show='*') self.hostname = Entry(self) self.service = Entry(self) self.port = Entry(self) self.username.insert(0, initialUser) self.password.insert(0, initialPassword) self.service.insert(0, initialService) self.hostname.insert(0, initialHostname) self.port.insert(0, str(initialPortno)) userlbl = Label(self, text="Username:"******"Password:"******"Service:") hostlbl = Label(self, text="Hostname:") portlbl = Label(self, text="Port #:") self.logvar = StringVar() self.logvar.set("Protocol PB-%s" % pb.Broker.version) self.logstat = Label(self, textvariable=self.logvar) self.okbutton = Button(self, text="Log In", command=self.login) version_label.grid(column=0, row=0, columnspan=2) z = 0 for i in [[userlbl, self.username], [passlbl, self.password], [hostlbl, self.hostname], [servicelbl, self.service], [portlbl, self.port]]: i[0].grid(column=0, row=z + 1) i[1].grid(column=1, row=z + 1) z = z + 1 self.logstat.grid(column=0, row=6, columnspan=2) self.okbutton.grid(column=0, row=7, columnspan=2) self.protocol('WM_DELETE_WINDOW', self.tk.quit)
def __init__(self, parent, title, action, currentKeySequences, _htest=False): """ action - string, the name of the virtual event these keys will be mapped to currentKeys - list, a list of all key sequence lists currently mapped to virtual events, for overlap checking _htest - bool, change box location when running htest """ Toplevel.__init__(self, parent) self.configure(borderwidth=5) self.resizable(height=FALSE, width=FALSE) self.title(title) self.transient(parent) self.grab_set() self.protocol("WM_DELETE_WINDOW", self.Cancel) self.parent = parent self.action = action self.currentKeySequences = currentKeySequences self.result = '' self.keyString = StringVar(self) self.keyString.set('') self.SetModifiersForPlatform( ) # set self.modifiers, self.modifier_label self.modifier_vars = [] for modifier in self.modifiers: variable = StringVar(self) variable.set('') self.modifier_vars.append(variable) self.advanced = False self.CreateWidgets() self.LoadFinalKeyList() self.withdraw() #hide while setting geometry self.update_idletasks() self.geometry("+%d+%d" % (parent.winfo_rootx() + (parent.winfo_width() / 2 - self.winfo_reqwidth() / 2), parent.winfo_rooty() + ((parent.winfo_height() / 2 - self.winfo_reqheight() / 2) if not _htest else 150)) ) #centre dialog over parent (or below htest box) self.deiconify() #geometry set, unhide self.wait_window()
def __init__(self, canvasWidth, canvasHeight, viewCenterX=0.0, viewCenterY=0.0, viewWidth=1.0, viewHeight=1.0, **kw): Toplevel.__init__(self, **kw) self.viewCenterX = viewCenterX self.viewCenterY = viewCenterY self.viewWidth = viewWidth self.viewHeight = viewHeight self.canvas = Canvas(self, width=canvasWidth, height=canvasHeight) self.canvas.pack() self.protocol("WM_DELETE_WINDOW", self.onClose) self.bind("<Configure>", self.onResize)