def on_find(): t2 = Toplevel(root) t2.title("Find") t2.iconbitmap("icons/find.ico") t2.geometry("262x65+200+250") t2.transient(root) Label(t2, text="Find All:").grid(row=0, column=0, sticky='e') v = StringVar() e = Entry(t2, width=25, textvariable=v) e.grid(row=0, column=1, padx=2, pady=2, sticky='we') e.focus_set() c = IntVar() Checkbutton(t2, text="Ignore Case", variable=c).grid(row=1, column=1, padx=2, pady=2, sticky='e') Button(t2, text="Find All", command=lambda: search_for(v.get(), c.get(), textarea, t2, e)).grid( row=0, column=2, sticky='e' + 'w', padx=2, pady=2) def close_search(): textarea.tag_remove('match', 1.0, END) t2.destroy() t2.protocol('WM_DELETE_WINDOW', close_search)
def treeMenuDeleteSelected(self): """Create confirmation window for multiple deletions - from popup menu.""" # window confirm = Toplevel() x = self.master.winfo_x() y = self.master.winfo_y() confirm.title('Offline Pass') confirm.geometry(f'+{x}+{y}') confirm.iconbitmap(self.cwd + '/imgs/favicon.ico') confirm.resizable(False, False) # widget init items = self.entriesTree.selection() itemInfo = self.entriesInfo[int(items[0])] # widget confirmLabel = Label(confirm, text='Are You Sure?') confirmYes = Button(confirm, text='Yes', command=lambda: self.checkDeleteSelected( items, self.entriesInfo, confirm)) confirmNo = Button(confirm, text='No', command=lambda: confirm.destroy()) # widget pack confirmLabel.grid(row=0, column=0) confirmYes.grid(row=1, column=1) confirmNo.grid(row=1, column=0)
def printFiles(self): for pdf in self.PDFs: self.jobCounter = ghostscript("\"T:\RELEASED_FILES\CURRENT_PDF\\"+pdf.replace("\"","")+"\"", self.jobCounter, self.selectedPrinter.get(), self.selectedPaper.get(),self.POPENFile) #print (jobCounter) if self.print_wrong_revision_var.get(): for pdf in self.wrongRevsion: self.jobCounter = ghostscript("\"T:\RELEASED_FILES\CURRENT_PDF\\"+pdf.replace("\"","")+"\"", self.jobCounter, self.selectedPrinter.get(), self.selectedPaper.get(),self.POPENFile) #os.remove(self.POPENFile) posx = 500 posy = 400 sizex = 500 sizey = 100 top = Toplevel() top.title("Done") top.grid_rowconfigure(0,weigh=1) top.grid_columnconfigure(0, weight=1) top.wm_geometry("%dx%d+%d+%d" % (sizex, sizey, posx, posy)) msg = Message(top, text="Sent all files to printer.\nPlease wait for the printer to finish", width=200, pady=10) msg.grid(row=0, column=0, columnspan=4) top.focus_force() self.current_window = top if self.runningInFrozen: top.iconbitmap(sys._MEIPASS+r"/emblem_print.ico") else: top.iconbitmap("emblem_print.ico") top.bind("<FocusOut>", self.Alarm) button = Button(top,text="Ok", command=top.quit) button.grid(row=1, column=0)
class MessageManagerWindow: def __init__(self, parent): self.master = Toplevel(parent) self.master.withdraw() self.master.geometry('+{x}+{y}'.format(x=parent.winfo_x(), y=parent.winfo_y())) self.master.wm_attributes("-topmost", 1) self.master.focus_force() self.master.wm_title("StreamTicker Message Manager") self.master.iconbitmap("imagefiles/stIcon.ico") self.master.resizable(False, False) self.master.grab_set() self.window = parent self.cancelMessages = deepcopy(self.window.messages) self.messages = sorted(self.window.messages, key=lambda x: x.sortOrder) self.mlFrame = MessageManagerListFrame(self) self.mlFrame.frame.grid(row=0, column=1, padx=(4, 4), pady=4) self.mbFrame = MessageButtonFrame(self) self.mbFrame.frame.grid(row=0, column=0, padx=(4, 0), pady=4) self.okFrame = MessageOkCancelFrame(self) self.okFrame.frame.grid(row=1, column=1, padx=4, pady=4, sticky=E) self.master.deiconify() self.master.mainloop()
def _waitbox(self, method): """ Creates a waitbox while the app is running. This prevents the app from hanging. """ # Basic tasks to set up the waitbox Toplevel widget. top = Toplevel(self.parent) top.title("Please wait...") top.resizable(0, 0) fr = Frame(top) fr.pack() # pack the Label with the correct working mode. ttk.Label( fr, text=messages.waitbox_msg.format(method=method), ).pack(anchor='center') if self.parent.iconname() is not None: top.iconbitmap(self.parent.iconname()) # User cannot destroy windows manually while program is running top.protocol('WM_DELETE_WINDOW', lambda: None) self.parent.protocol('WM_DELETE_WINDOW', lambda: None) top.transient(self.parent) top.focus_set() top.grab_set() return top
def create_window(self): # Toplevel means that if the GP window will be closed the project page will be closed to. window = Toplevel(self.__gp_root) self.__project_root = window window.iconbitmap('GP_logo.ico') window.geometry('1200x800') window.resizable(width=False, height=False) window.title_font = tkfont.Font(family=HELVETICA, size=18, weight=BOLD) window.cretiria_font = tkfont.Font(family=FIXEDSYS, size=10) self.menuBar() self.present_project_directories() Label(window, text=get_project_name(self.__project), font=window.title_font).pack() self.__chatText = tktext.ScrolledText(master=window, wrap=WORD, state=DISABLED, width=45, height=40) self.__chatText.place(x=700, y=50) self.__chatEntry = Entry(window, width=60) self.__chatEntry.place(x=700, y=720) self.__users_list = Listbox(self.__project_root, width=15, height=40, selectmode=SINGLE) self.__users_list.place(x=1070, y=50) self.users_list() self.__users_list.bind('<Double-1>', self.open_profile_pages) self.chat_history() self.__chatEntry.bind('<Return>', self.send_messages) GetMessages(self.__client_socket, self.__chatText, self.__project, self).start() self.__project_root.protocol("WM_DELETE_WINDOW", self.close_project_page)
def open_settings(): global top_settings top_settings = Toplevel(root) top_settings.iconbitmap('settings.ico') top_settings.resizable(False, False) top_settings.title("Settings") check_automation_checking(top_settings) frequency_checking_new_messages(top_settings) set_new_time_or_continue_after_manual_check(top_settings) ask_if_close_application(top_settings) save_settings_button = Button(top_settings, text="Save settings", font=('Verdana', 9, 'bold'), background="blue", command=save_settings) save_settings_button.grid(column=1, row=10, sticky=E, padx=9, pady=9) cancel_settings_button = Button(top_settings, text="Close settings", command=exit_from_settings) cancel_settings_button.grid(column=0, row=10, sticky=E, padx=10, pady=10) default_settings_button = Button(top_settings, text="Default settings (no save)", command=set_default_settings) default_settings_button.grid(column=0, row=10, sticky=W, padx=11, pady=11) top_settings.mainloop()
def main(extension): root = Toplevel() if 'DejaVu Sans' in list(prgm.font.families()): police = prgm.font.Font(root, family='DejaVu Sans', size=10) root.option_add('*Font', police) qualite = prgm.IntVar(root) qualite.set(100) bar_qualite = Scale(root, from_=100, to=500, orient='horizontal', var=qualite, tickinterval=50, label='Résolution', length=325, resolution=5) bar_qualite.grid(column=0, row=0) prgm.Label(root, text='', width=50).grid(column=0, row=1) bouton_fermer = prgm.Button(root, text='Valider', command=root.destroy) bouton_fermer.grid(column=0, row=2) root.title('Exporter en png') root.resizable(width=False, height=False) if prgm.os.name == 'nt': root.iconbitmap('python.ico') prgm.root.wait_window(root) return qualite.get()
class MessageComponentWindow: def __init__(self, parent, messagePart: MessagePart, index: int): self.parent = parent self.parentWindow = parent.window.master self.master = Toplevel(self.parentWindow) self.master.withdraw() self.existingMessagePart = messagePart self.messagePart = deepcopy(messagePart) self.index = index self.master.geometry('+{x}+{y}'.format( x=self.parentWindow.winfo_x() + 10, y=self.parentWindow.winfo_y() + 10)) self.master.wm_attributes("-topmost", 1) self.master.focus_force() self.master.wm_title("StreamTicker Message Component") self.master.iconbitmap("imagefiles/stIcon.ico") self.master.resizable(False, False) self.master.grab_set() self.master.protocol("WM_DELETE_WINDOW", self.deleteWindow) self.componentFrame = MessageComponentFrame(self) self.componentFrame.frame.grid(row=0, sticky=NSEW, padx=4, pady=4) self.okCancelFrame = MessageComponentOkCancelFrame(self) self.okCancelFrame.frame.grid(row=2, column=0, padx=4, pady=4, sticky=E) self.master.deiconify() self.master.mainloop() def deleteWindow(self): self.master.destroy() self.parentWindow.lift() self.parentWindow.wm_attributes("-topmost", 1) self.parentWindow.grab_set() def returnMessageComponent(self): if validate(self.componentFrame, self.master): if self.existingMessagePart: self.parent.messageMakerPartFrame.parent.message.parts[ self.index] = MessagePart( self.componentFrame.componentType.get(), self.index, self.componentFrame.getValue()) else: self.existingMessagePart = MessagePart( self.componentFrame.componentType.get(), self.index, self.componentFrame.getValue()) self.parent.messageMakerPartFrame.parent.message.parts.append( self.existingMessagePart) self.parent.populateListbox( self.parent.messageMakerPartFrame.parent.message.parts) self.deleteWindow()
def displayFileStructure(): logo = PhotoImage(file="filestructure.png") top = Toplevel() top.iconbitmap("sce_icon.ico") top.resizable(0, 0) top.geometry("590x550") top.title("File Structure") logolabel = Label(top, image=logo) logolabel.grid(column=0, row=0) top.mainloop()
def window(toplevel, user, name, size, alert=False): # Creates new window window = Toplevel(toplevel) window.title(user.company_name + ' - ' + name) window.iconbitmap(user.company_icon) bg = bg_set(user, alert) window.configure(bg=bg) if size == 'small': window.minsize(user.small_window_width, user.small_window_height) else: window.minsize(user.medium_window_width, user.medium_window_height) return window
class MainWindow: def __init__(self): global root self.master = Toplevel(root) self.master.withdraw() self.master.protocol('WM_DELETE_WINDOW', root.destroy) self.master.iconbitmap(imgdir) self.master.geometry("400x150") self.master.resizable(False, False) self.master.title("Adb & Fastboot Installer - By @Pato05") estyle = Style() estyle.element_create("plain.field", "from", "clam") estyle.layout("White.TEntry", [('Entry.plain.field', {'children': [( 'Entry.background', {'children': [( 'Entry.padding', {'children': [( 'Entry.textarea', {'sticky': 'nswe'})], 'sticky': 'nswe'})], 'sticky': 'nswe'})], 'border': '4', 'sticky': 'nswe'})]) estyle.configure("White.TEntry", background="white", foreground="black", fieldbackground="white") window = Frame(self.master, relief=FLAT) window.pack(padx=10, pady=5, fill=BOTH) Label(window, text='Installation path:').pack(fill=X) self.syswide = IntVar() self.instpath = StringVar() self.e = Entry(window, state='readonly', textvariable=self.instpath, style='White.TEntry') self.e.pack(fill=X) self.toggleroot() Label(window, text='Options:').pack(pady=(10, 0), fill=X) inst = Checkbutton(window, text="Install Adb and Fastboot system-wide?", variable=self.syswide, command=self.toggleroot) inst.pack(fill=X) self.path = IntVar(window, value=1) Checkbutton(window, text="Put Adb and Fastboot in PATH?", variable=self.path).pack(fill=X) Button(window, text='Install', command=self.install).pack(anchor='se') self.master.deiconify() def toggleroot(self): if self.syswide.get() == 0: self.instpath.set(installpaths['user']) elif self.syswide.get() == 1: self.instpath.set(installpaths['system']) def install(self): self.app = InstallWindow(setpath=self.path.get( ), installpath=self.instpath.get(), systemwide=self.syswide.get()) self.master.destroy()
class About: """Show about window.""" def __init__(self, parent): self.parent = parent self._setup_ui() self._setup_widgets() def _setup_ui(self): """About window toplevel.""" self.about = Toplevel() self.about.resizable(False, False) self.about.title(_("About")) self.about.transient(self.parent) # Set position TopLevel pos_x = self.parent.winfo_x() pos_y = self.parent.winfo_y() self.about.geometry("+%d+%d" % (pos_x + 200, pos_y + 200)) if sys.platform == "win32": self.about.iconbitmap(r"./assets/icon.ico") else: self.about.iconphoto(True, PhotoImage(file=r"./assets/icon.png")) def _setup_widgets(self): frame = Frame(self.about) frame.pack(pady=20, padx=40) title = Label(frame, text="Multiple Renaming", font=("sans-serif", 16)) title.pack() subtitle = Label(frame, text="File renaming utility.", font=("sans-serif", 12)) subtitle.pack() version_text = f"Version {versions.__version__}" version = Label(frame, text=version_text) version.pack() link_lbl = Label(frame, text="Website", fg="blue", cursor="hand2") link_lbl.pack() link_lbl.bind("<Button-1>", lambda e: webbrowser.open_new(versions.__website__)) ttk.Separator(frame, orient="horizontal").pack(fill="x", pady=10) _license = Label(frame, text="Copyright© 2020 - Vincent Houillon", font=("sans-serif", 8)) _license.pack()
def __call__(self, *args, **kwargs): makemodal = True newwindow = Toplevel() newwindow.iconbitmap(r'E:\WebProjects\Шаблоны BFG\Templates\site\images\favicon.ico') """ Don`t close window with X """ newwindow.protocol('WM_DELETE_WINDOW', lambda: None) newwindow.title('MyNewWindow') Button(newwindow, text='Choise Color!', bg='green', command=self.show_color).pack() Button(newwindow, text='Destroy new window!!!', bg='red', command=newwindow.destroy).pack() if makemodal: newwindow.focus_set() newwindow.grab_set() newwindow.wait_window()
def showError(location, panel): errorWindow = Toplevel(panel) errorWindow.title("not found") errorWindow.geometry("400x50") errorWindow.resizable(0, 0) errorWindow.configure(bg='white') errorWindow.iconbitmap('sad-cloud.ico') textLabel = Label( errorWindow, text='We are sorry, we could not find {} '.format(location), font=(fonts.errorFont)) textLabel.configure(bg='white') textLabel.pack()
def main(Tin='',isexit=False,code=[]): global root,user,text,tinfun,TinReader,TinOut if Tin!='': tinfun=Tin TinReader=True else: tinfun='' TinReader=False if isexit==True: TinOut=True root=Toplevel() if TinReader==True: root.withdraw() sw = root.winfo_screenwidth() #得到屏幕宽度 sh = root.winfo_screenheight() #得到屏幕高度 root.title('Tin-shell') root['background']='grey' root.geometry("1200x625+%d+%d" % ((sw-1200)/2,(sh-625)/2)) root.resizable(0,0) root.protocol('WM_DELETE_WINDOW',exit_window) root.iconbitmap(TinPath+'\\Tin.ico') user=Entry(root,font=('微软雅黑',14),insertbackground='lightblue',bg='black',fg='lightblue',insertwidth=1) user.bind('<Control-g>',go_test)#测试命令 user.place(x=0,y=0,relwidth=1,height=26) user.bind('<Return>',get_call) text=scrolledtext.ScrolledText(root,font=('楷体',14),bg='black') text.place(x=0,y=29,relwidth=1,height=596) text.tag_configure('error',foreground='red') text.tag_configure('shell',foreground='orange') text.tag_configure('output',foreground='lightblue',font='微软雅黑') text.insert('end',''' __________________ ___ ____ ___ writen by Smart-Space /_________________/ /__/ / \ / / for creaters for Tin / / ___ / /\ \ / / to control Tin-units / / / / / / \ \ / / ===================== / / / / / / \ \ / / The same as using Tin / / / / / / \ \ / / as a poster. Also can / / / / / / \ \/ / oprate the exefile in /___/ /__/ /__/ \____/ an easy way. [version|TinShell-{}][By|Smart-Space 🐲][filetype|*.tinc][language|TinCode]\n\n'''.format(version),'shell') text.insert('end','>>> ','shell') text['state']='disabled' if TinReader==False: root.mainloop() else: StartCode(code)
def __about(self): ''' None -> None Associated with the Help Menu. Creates a new window with the "About" information ''' appversion = "1.5" appname = "Paragon GIS Analyst" copyright = 14 * ' ' + '(c) 2014' + 12 * ' ' + \ 'SDATO - DP - UAF - GNR\n' + 34 * ' '\ + "No Rights Reserved... ask the code ;)" licence = 18 * ' ' + 'http://opensource.org/licenses/GPL-3.0\n' contactname = "Nuno Venâncio" contactphone = "(00351) 969 564 906" contactemail = "*****@*****.**" message = "Version: " + appversion + 5 * "\n" message0 = "Copyleft: " + copyright + "\n" + "Licença: " + licence message1 = contactname + '\n' + contactphone + '\n' + contactemail icons = os.getcwd() + os.sep + "icons" + os.sep # path to icons icon = icons + "maps.ico" tl = Toplevel(self.master) tl.configure(borderwidth=5) tl.title("Sobre...") tl.iconbitmap(icon) tl.resizable(width=FALSE, height=FALSE) f1 = Frame(tl, borderwidth=2, relief=SUNKEN, bg="gray25") f1.pack(side=TOP, expand=TRUE, fill=BOTH) l0 = Label(f1, text=appname, fg="white", bg="gray25", font=('courier', 16, 'bold')) l0.grid(row=0, column=0, sticky=W, padx=10, pady=5) l1 = Label(f1, text=message, justify=CENTER, fg="white", bg="gray25") l1.grid(row=2, column=0, sticky=E, columnspan=3, padx=10, pady=0) l2 = Label(f1, text=message0, justify=LEFT, fg="white", bg="gray25") l2.grid(row=6, column=0, columnspan=2, sticky=W, padx=10, pady=0) l3 = Label(f1, text=message1, justify=CENTER, fg="white", bg="gray25") l3.grid(row=7, column=0, columnspan=2, padx=10, pady=0) button = Button(tl, text="Ok", command=tl.destroy, width=10) button.pack(pady=5)
def __about(self): ''' None -> None Associated with the Help Menu. Creates a new window with the "About" information ''' appversion = "1.6" appname = "EXCEL to KML Transformer" copyright = 14 * ' ' + '(c) 2013' + 12 * ' ' + \ 'SDATO - DP - UAF - GNR\n' + 34 * ' '\ + "All Rights Reserved" licence = 18 * ' ' + 'http://opensource.org/licenses/GPL-3.0\n' contactname = "Nuno Venâncio" contactphone = "(00351) 969 564 906" contactemail = "*****@*****.**" message = "Version: " + appversion + 5 * "\n" message0 = "Copyright: " + copyright + "\n" + "Licença: " + licence message1 = contactname + '\n' + contactphone + '\n' + contactemail icons = os.getcwd() + os.sep + "icons" + os.sep # path to icons icon = icons + "compass.ico" tl = Toplevel(self.master) tl.configure(borderwidth=5) tl.title("Sobre...") tl.iconbitmap(icon) tl.resizable(width=FALSE, height=FALSE) f1 = Frame(tl, borderwidth=2, relief=SUNKEN, bg="gray25") f1.pack(side=TOP, expand=TRUE, fill=BOTH) l0 = Label(f1, text=appname, fg="white", bg="gray25", font=('courier', 16, 'bold')) l0.grid(row=0, column=0, sticky=W, padx=10, pady=5) l1 = Label(f1, text=message, justify=CENTER, fg="white", bg="gray25") l1.grid(row=2, column=0, sticky=E, columnspan=3, padx=10, pady=0) l2 = Label(f1, text=message0, justify=LEFT, fg="white", bg="gray25") l2.grid(row=6, column=0, columnspan=2, sticky=W, padx=10, pady=0) l3 = Label(f1, text=message1, justify=CENTER, fg="white", bg="gray25") l3.grid(row=7, column=0, columnspan=2, padx=10, pady=0) button = Button(tl, text="Ok", command=tl.destroy, width=10) button.pack(pady=5)
def SettingWindow(self): x = self.root.winfo_x() y = self.root.winfo_y() settingWinRoot = Toplevel(self.root) settingWinRoot.grab_set() settingWinRoot.resizable(False,False) settingWinRoot.geometry("%dx%d+%d+%d" % (500,200,x + 50,y + 50)) settingWinRoot.title("Setting") settingWinRoot.iconbitmap("./icon/icon.ico") settingWinRoot.configure(background=self.Theme2["color2"],) f1 = Frame(settingWinRoot,width=450, height=500, background=self.Theme1['color3'],borderwidth=3,relief = "raised") f1.pack(fill =NONE, pady=20,padx=10) Label(f1,text="File Path:",font="bell 12 italic",bg=self.Theme1['color3'],fg="Black").place(x=10,y=20) self.pathLabel = Entry(f1,font="bell 10 bold") Button(f1,text="Select Path",command = self.askSaveDirectory,borderwidth=2,bg=self.Theme2["color3"],foreground="white").place(x=310,y=20) self.pathLabel.insert(0,self.filepath) self.pathLabel.place(x=100,y=20,height=25,width=200)
def initializeWindow(window: Toplevel, parent, width: int, height: int, xoffset: int, yoffset: int, label: str): parent.window.attributes('-disabled', 1) window.iconbitmap(FileConstants.STREAMOPENER_ICON) if width == 0 or height == 0: window.geometry('+{x}+{y}'.format( x=parent.window.winfo_x() + xoffset, y=parent.window.winfo_y() + yoffset)) else: window.geometry('{w}x{h}+{x}+{y}'.format( w=width, h=height, x=parent.window.winfo_x() + xoffset, y=parent.window.winfo_y() + yoffset)) window.title(label) window.resizable(width=False, height=False) window.transient(parent.window) window.grab_set()
def export(self): """ callback method for the export button opens a prompt asking for filename in order to save the figure """ def cancel(): logging.info('Canceling export') self.span_min = False popup.destroy() popup.update() def save(): logging.info('Asking for filename') if not export_popup_entry.get().strip(): logging.info('No filename given') error_label = Label(popup, text="Please add a filename!", fg="red") error_label.grid(row=1, column=0) else: filename = self.project_path + export_popup_entry.get( ) + '.pdf' logging.info('Saving figure at {}'.format(filename)) with PdfPages(filename) as export_pdf: plt.figure(self.window_id * 2 - 1) export_pdf.savefig() plt.figure(self.window_id * 2) export_pdf.savefig() logging.info('Export finished') cancel() logging.info('Exporting graph to pdf') popup = Toplevel(self.master) popup.title('') popup.iconbitmap(r'res/general_images/favicon.ico') popup.grab_set() export_popup_label = Label(popup, text="Enter desired file name: ") export_popup_label.grid(row=0, column=0) export_popup_entry = Entry(popup) export_popup_entry.grid(row=0, column=1) close_export_popup_button = Button(popup, text="Confirm", command=save) close_export_popup_button.grid(row=1, column=1)
class UninstallWindow: def __init__(self, installpath, installtype): global root self.installpath = installpath self.installtype = installtype self.master = Toplevel(root) self.master.withdraw() self.master.iconbitmap(imgdir) self.master.protocol('WM_DELETE_WINDOW', root.destroy) self.master.title('Adb & Fastboot uninstaller - By @Pato05') self.master.resizable(False, False) self.master.geometry('400x100+100+100') frame = Frame(self.master, relief=FLAT) frame.pack(padx=10, pady=5, fill=BOTH) Label(frame, text='Found an installation of Adb & Fastboot.', font=('Segoe UI', 12)).pack(fill=X) Label(frame, text='What do you want to do?', font=('Segoe UI', 12)).pack(fill=X) btnframe = Frame(frame, relief=FLAT) btnframe.pack(fill=X, pady=(10, 0)) Button(btnframe, text='Uninstall', command=self.uninstall).pack( side=LEFT, anchor='w', expand=1) Button(btnframe, text='Update', command=self.update).pack( side=RIGHT, anchor='e', expand=1) self.master.deiconify() def uninstall(self): self.app = FinishWindow(True, self.remove(True), None, 'uninstall') self.master.destroy() def remove(self, removePath=True): from subprocess import call as subcall subcall([os.path.join(self.installpath, "adb.exe"), 'kill-server'], creationflags=0x00000008) rmtree(self.installpath) if removePath: return clearPath(self.installpath, self.installtype == 'system') else: return True def update(self): self.remove(False) self.app = InstallWindow( False, self.installpath, self.installtype == 'system', 'update') self.master.destroy()
def create_window(self): window = Toplevel(self.__project_root) self.__profile_root = window window.iconbitmap('GP_logo.ico') window.geometry('400x400') window.resizable(width=False, height=False) window.title_font = tkfont.Font(family=HELVETICA, size=20, weight=BOLD) window.cretiria_font = tkfont.Font(family=FIXEDSYS, size=10) if self.__user_profile == self.__user: Label(window, text="My Profile\n\n", font=window.title_font).pack() else: Label(window, text=get_user_name(self.__user_profile) + "'s Profile\n\n", font=window.title_font).pack() Label(window, text="first name: " + get_user_firstname(self.__user) + "\n", font=window.cretiria_font).pack() Label(window, text="last name: " + get_user_lastname(self.__user) + "\n", font=window.cretiria_font).pack() Label(window, text="email: " + get_user_email(self.__user) + "\n", font=window.cretiria_font).pack() Label(window, text="phone: " + get_user_phone(self.__user) + "\n", font=window.cretiria_font).pack() self.__profile_root.protocol("WM_DELETE_WINDOW", self.close_profile_page)
def drawRandom(): # Get Input names = NameArea.get("1.0", END).split("\n") reasons = ReasonArea.get("1.0", END).split("\n") nominators = NominatorArea.get("1.0", END).split("\n") if (not (len(names) == len(reasons))) or (not (len(reasons) == len(nominators))): messagebox.showerror( "Dataset Error", "The amount of data in each column is not the same.") else: allPeople = [] for i in range(len(names)): if i < len(names) - 1: allPeople.append([names[i], reasons[i], nominators[i]]) ##print(allPeople) # Get random choices try: numberOfPeople = int(PeopleNumArea.get("1.0", END)) except: messagebox.showerror("Randomizer Error", "The amount of people to draw must be a number.") finalPeople = [] for i in range(numberOfPeople): finalPeople.append( allPeople.pop(allPeople.index(secrets.choice( allPeople)))) ### Write custom function later to tidy up code # Result Window output = "" for person in finalPeople: output += ("{person}: {reason} - {who}\n".format(person=person[0], reason=person[1], who=person[2])) outFile = open("output.txt", "w") outFile.write(output) outFile.close() resultWindow = Toplevel() resultWindow.geometry("400x300") resultWindow.iconbitmap("superMario.ico") resultWindow.title("Results") resultText = Text(resultWindow) resultText.place(x=10, y=10, width=380, height=280) resultText.insert(END, output)
def Ajuda(txt=''): windowWelcome = Toplevel() windowWelcome.iconbitmap('favicon.ico') windowWelcome.title('Bem vindo ao CEBRS4 to GEE!') image = Image.open("banner3_ajudaC4GEE.png") photo = ImageTk.PhotoImage(image) label = Label(windowWelcome, image=photo) label.image = photo # keep a reference! label.pack() ''' img_ajuda = PhotoImage(file='banner3_ajudaC4GEE.png') label_ajudaimg = Label(windowWelcome, image=img_ajuda) label_ajudaimg.grid(row=2,column=0)''' text_box_Welcome = Text(windowWelcome, width=80, height=20, wrap=WORD, background="white") text_box_Welcome.pack() # .grid(row=4,column=0) textoInicial = "Bem Vindo ao CBERS4 to GEE! Este programa realiza a importação de imagens do satélite CBERS4 banda MUX para sua conta no Google Earth Engine.\n\n" \ "Você precisa preencher requisitos mínimos para utilizar este programa:\n" \ "1 - Ter um conta no Google.\n" \ "2 - Ter uma conta no Catálogo do INPE (Instituto Nacional de Pesquisas Espaciais). Você pode se cadastrar no catálogo do INPE atravês do site http://www.dgi.inpe.br/CDSR/ clicando em <Cadastro> e registrando-se pelo formulário de cadastro. \n" \ "3 - Ter uma conta no Google Earth Engine (GEE). Você pode ter uma conta no Google Earth Engine registrando-se através do site https://earthengine.google.com/ . \n" \ "4 - Ter uma conta no Google Cloud. Você pode ter uma conta no Google Cloud registrando-se através do site https://cloud.google.com/. Será solicitado o número do seu cartão de crédito, porém isso é só para registro da conta caso você deseje no futuro obter uma conta Google Cloud com mais recursos. \n" textoInicial = textoInicial + txt text_box_Welcome.insert(INSERT, textoInicial) def closeWindowWelcome(): windowWelcome.destroy() button_1_Welcome = Button(windowWelcome, text="Ok", command=closeWindowWelcome) # .grid(row=6,column=0,ipadx=100)#.pack(ipadx=100)#(row=2, column=0) button_1_Welcome.pack(ipadx=100) windowWelcome.mainloop()
def checkSettingsBeforePrint(self): if self.selectedPrinter.get() != '' and self.PDFs != None : printingThread = threading.Thread(target=self.printFiles) printingThread.start() else: if self.selectedPrinter.get() == '': posx = 500 posy = 400 sizex = 500 sizey = 100 top = Toplevel() top.grid_rowconfigure(0,weigh=1) top.grid_columnconfigure(0, weight=1) top.wm_geometry("%dx%d+%d+%d" % (sizex, sizey, posx, posy)) top.title("Printer not set") msg = Message(top, text="Set the default printer in\nPrinter Settings.",width=200, pady=10) msg.grid(row=0, column=0,columnspan=5) button = Button(top,text="Ok", command=top.destroy) button.grid(row=1, column=0) self.current_window = top if self.runningInFrozen: top.iconbitmap(sys._MEIPASS+r"/emblem_print.ico") else: top.iconbitmap("emblem_print.ico") top.focus_force() top.bind("<FocusOut>", self.Alarm) return None elif self.PDFs == None: posx = 500 posy = 400 sizex = 500 sizey = 100 top = Toplevel() top.grid_rowconfigure(0,weigh=1) top.grid_columnconfigure(0, weight=1) top.wm_geometry("%dx%d+%d+%d" % (sizex, sizey, posx, posy)) top.title("No file loaded") msg = Message(top, text="Browse for a file before printing.",width=200, pady=10) msg.grid(row=0, column=0,columnspan=5) button = Button(top,text="Ok", command=top.destroy) button.grid(row=1, column=0) self.current_window = top if self.runningInFrozen: top.iconbitmap(sys._MEIPASS+r"/emblem_print.ico") else: top.iconbitmap("emblem_print.ico") top.focus_force() top.bind("<FocusOut>", self.Alarm) return None
class SettingsWindow: def __init__(self, parent): self.master = Toplevel(parent) self.master.withdraw() self.master.geometry('+{x}+{y}'.format(x=parent.winfo_x(), y=parent.winfo_y())) self.master.wm_attributes("-topmost", 1) self.master.focus_force() self.master.wm_title("StreamTicker Settings") self.master.iconbitmap("imagefiles/stIcon.ico") self.master.resizable(False, False) self.master.grab_set() self.parent = parent self.fields = SettingsGUIFields() self.mFrame = SettingsMessageFrame(self.master, self.fields) self.mFrame.frame.grid(row=0, column=0, rowspan=3, sticky=NSEW, padx=4, pady=4) self.bgFrame = SettingsBackgroundFrame(self, self.fields) self.bgFrame.frame.grid(row=0, column=1, sticky=NSEW, padx=4, pady=4) self.sFrame = SettingsWindowFrame(self.master, self.fields) self.sFrame.frame.grid(row=1, column=1, sticky=NSEW, padx=4, pady=4) self.okFrame = OkCancelFrame(self) self.okFrame.frame.grid(row=2, column=1, sticky=SE, padx=4, pady=4) self.fields.loadSettings(self.master, self.parent, self.mFrame, self.bgFrame) self.master.deiconify() self.master.mainloop()
def compress(): if compressButton['bg'] == "red": messagebox.showerror( title="Compression Error", message= "Please check that the Source Directory, Data Type/Resolution, and Destination Directory are valid selections (all 3 buttons should be green).\n\nA window will pop up after this message to display a valid configuration." ) correct_selection = PhotoImage(file="correct_selection.png") top = Toplevel() top.iconbitmap("error.ico") top.resizable(0, 0) top.geometry("450x150") top.title("Example of Valid Configuration") ref_pic = Label(top, image=correct_selection) ref_pic.grid(column=0, row=0) top.mainloop() else: srcPath = parameters["source"] dstPath = parameters["dest"] dataType = parameters["Data Type"] # Timing Execution start = time.time() zipFiles(srcPath, dstPath, dataType) # Timing Execution end = time.time() elapsed = end - start messagebox.showinfo( title="Status Update", message="Compression completed in:\r\n{0} seconds".format(elapsed)) #Reset parameters resetParameters()
def show_setting(root): global exe global PAL PALL, exe = read_ini() top = Toplevel(root, takefocus=True) top.focus_force() top.title("Setting ORCA-Q") top.iconbitmap("icons\\setting.ico") top.geometry("310x180") top.resizable(0,0) top.grab_set() top_frame = Frame(top, width=100, height=300) top_frame.pack() pall = IntVar(value=(PALL-1)) top_qt = Label(top_frame, text="\nRun in series or parallel?") top_qt.grid(row=1, column=0, sticky="w") top_rb1 = ttk.Radiobutton(top_frame, text="Serie", value=0, variable=pall) top_rb1.grid(row=2, column=0) top_rb2 = ttk.Radiobutton(top_frame, text="Parallel", value=1, variable=pall) top_rb2.grid(row=2, column=1) top_dir = Label(top_frame, text="\nORCA Path:") top_dir.grid(row=4, column=0, sticky="w") et_top = ttk.Entry(top_frame, width=33) et_top.grid(row=5, column=0, columnspan=2, sticky="e") et_top.insert("end", exe) bt_top = ttk.Button(top_frame, text="Browse...", command=lambda:open_dirORCA(et_top)) bt_top.grid(row=5, column=2, sticky="w") #print(pall.get()) spe = Label(top_frame) spe.grid(row=6, column=0) bt_save = ttk.Button(top_frame, text="Save", command=lambda:save_ini(pall)) bt_save.grid(row=7, column=0, columnspan=4)
def displayAbout(): logo = PhotoImage(file="sce_logo.png") top = Toplevel() top.iconbitmap("sce_icon.ico") top.resizable(0, 0) top.geometry("255x260") top.title("About") logolabel = Label(top, image=logo) logolabel.grid(column=0, row=0) aboutlabel = Label( top, text= "Created by:\r\nJulian Chan\r\nUndergraduate Summer Intern 2017\r\nPower Systems Technologies\r\nAdvanced Technology Group", justify="center", bg="lightblue", font="bold") versionlabel = Label(top, text="Version 1.0 (Release: July 20, 2017)", justify="center") aboutlabel.grid(column=0, row=1) versionlabel.grid(column=0, row=2) top.mainloop()
def reset_server(): '''Restarts Choosing of CSV Files''' global tempdir, tempdir2, opened, gui, httpd threading.Thread(target=httpd.shutdown, daemon=True).start() threading.Thread(target=httpd.server_close, daemon=True).start() gui = Toplevel() gui.title('PythonGUI') #Title gui.iconbitmap('resources/snake.ico') #GUI Icon gui.minsize(500, 540) #Size of GUI gui.attributes('-topmost', True) #Set GUI to always be the topmost window opened = [0, 0] tempdir, tempdir2 = '', '' photo = PhotoImage(file="resources/gui.png") #Logo label_five = Label(gui, image=photo).grid(pady=10) btn_one = Button(gui, text="Choose 1st CSV file", command=lambda: open_file('1')).grid( pady=4) #CSV Selection btn_two = Button(gui, text="Choose 2nd CSV file", command=lambda: open_file('2')).grid(pady=4) browsers = { 'Firefox': "firefox", 'Chrome': "chrome", 'Opera': "opera", 'Iexplore': "iexplore" } items = StringVar(value=tuple(sorted(browsers.keys()))) listbox = Listbox(gui, listvariable=items, width=40, height=5) #Browser Selection listbox.grid(column=0, row=4, rowspan=6, pady=10) selectButton = Button(gui, text='Select Browser', underline=0, command=lambda: selection(listbox.selection_get())) selectButton.grid(pady=10) gui.mainloop()