def __init__(self): self.play=1 self.cont=0 self.ventana=tk.Tk() self.fig = Figure() style = ThemedStyle(self.ventana) style.set_theme("ubuntu") self.ventana.title("Práctica GUI SenseHat") self.cuaderno = ttk.Notebook(self.ventana) self.pagina1 = ttk.Frame(self.cuaderno) self.cuaderno.add(self.pagina1, text='Monitorización') self.labelframe1=ttk.LabelFrame(self.pagina1, text='Control') self.labelframe1.pack(expand=False) self.control() self.labelframe2=ttk.LabelFrame(self.pagina1, text='Medidas') self.labelframe2.pack(fill='both',expand=False) self.medidas() self.labelframe3=ttk.LabelFrame(self.pagina1, text='Histórico') self.labelframe3.pack(fill='both',expand=True) self.historico() self.pagina2 = ttk.Frame(self.cuaderno) self.cuaderno.add(self.pagina2, text='Grafica') self.cuaderno.pack(fill='both',expand=True) self.ventana.after(1000,self.obtenervalor2) self.ventana.mainloop()
def main(): root = tk.Tk() app = Main_gui_app(root) root.geometry("1500x900") style = ThemedStyle(root) style.set_theme("breeze") app.run()
def __init__(self, *args, **kwargs): tk.Tk.__init__(self, *args, **kwargs) # Defining root window's properties self.title_font = tkfont.Font(family='Comic Sans MS') container = tk.Frame(self) self.title("Currency Converter") self.geometry("700x400") self.resizable(False, False) self.wm_iconbitmap( 'D:\Learning\Python\Code\Python\Desktop application\Bikini.ico') # Defining Theme style = ThemedStyle(self) style.set_theme('scidgrey') container.pack(side="top", fill="both", expand=True) self.frames = {} for F in (StartPage, result_page): page_name = F.__name__ frame = F(parent=container, controller=self) self.frames[page_name] = frame frame.grid(row=0, column=0, sticky="nsew") self.show_frame("StartPage")
def show_graph(self): ''' Function displays graph stats window ''' try: self.msg["text"] = "" self.tl = Tk() # Setting Theme style = ThemedStyle(self.tl) style.set_theme("plastik") self.tl.title("Stats graph") # self.tl.resizable(False, False) # window position x = root.winfo_rootx() + 150 y = root.winfo_rooty() + 50 self.tl.geometry('+%d+%d' % (x, y)) graphFrame = Frame(self.tl, bg="blue") graphFrame.grid(row=0, column=0, sticky=E + W) treedata = {} treedata['Year'] = [] treedata['Pages'] = [] for child in self.tree.get_children(): ch = self.tree.item(child)["values"] ch_year = ch[3] ch_year_final = ch_year[:4] ch_pages = ch[2] # insert year into list if not in it if ch_year_final not in treedata['Year']: treedata['Year'].append(ch_year_final) treedata['Pages'].append(0) # calculate and add pages year_index = treedata['Year'].index(ch_year_final) treedata['Pages'][year_index] += ch_pages df1 = DataFrame(treedata, columns=['Year', 'Pages']) # place chart figure1 = plt.Figure(figsize=(6, 5), dpi=100) ax1 = figure1.add_subplot(111) bar1 = FigureCanvasTkAgg(figure1, graphFrame) # bar1.get_tk_widget().pack() bar1.get_tk_widget().grid(row=0, column=0, sticky=E + W) df1 = df1[['Year', 'Pages']].groupby('Year').sum() df1.plot(kind='bar', legend=True, ax=ax1) ax1.set_title('Pages per year') self.config() self.tl.protocol("WM_DELETE_WINDOW", self.config) self.tl.mainloop() except: pass
def create_ttk_styles(self, the_root): # { # TRY THE FOLLOWING try: # { self.style = ThemedStyle(the_root) # STYLE THEME self.style.set_theme("scidblue") # } except: # { errorMessage = str(sys.exc_info()[0]) + "\n" errorMessage = errorMessage + str(sys.exc_info()[1]) + "\n\t\t" errorMessage = errorMessage + str(sys.exc_info()[2]) + "\n" exc_type, exc_obj, exc_tb = sys.exc_info() fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] typeE = str("TYPE : " + str(exc_type)) fileE = str("FILE : " + str(fname)) lineE = str("LINE : " + str(exc_tb.tb_lineno)) messageE = str("MESG : " + "\n\n" + str(errorMessage) + "\n") print("\n" + typeE + "\n" + fileE + "\n" + lineE + "\n" + messageE) messagebox.showerror(title="ERROR!", message=typeE + "\n" + fileE + "\n" + lineE + "\n" + messageE)
def __create_table(self): """ creates and places the table that display the locations of the buses and the passengers for the line. uses the ttk. widgets Treeview combined with a scrollbar. and the ThemedStyle lib in order to give the dark themed look to the widget. :return: None """ base_x = self.__table_coords["x"] base_y = self.__table_coords["y"] base_width = self.__table_coords["width"] base_height = self.__table_coords["height"] self.__tree_style = ThemedStyle(self.__window) self.__tree_style.set_theme("black") self.__tree_style.configure("mystyle.Treeview", highlightthickness=0, bd=0, font=(self.__font_name, 11)) # Modify the font of the body self.__tree_style.configure("mystyle.Treeview", background="black", fieldbackground="black", foreground=GUI.__GREEN1) self.__tree_style.configure("mystyle.Treeview.Heading", font=(self.__font_name, 13, 'bold'), foreground=GUI.__GREEN1) # Modify the font of the headings scrollX = ttk.Scrollbar(self.__window, orient=HORIZONTAL) self.__tree = Treeview(self.__window, show="headings", columns=self.__headlines, xscrollcommand=scrollX.set, style = "mystyle.Treeview") self.__tree.place(x=base_x, y=base_y, width=base_width, height=base_height) scrollX.config(command=self.__tree.xview) scrollX.place(x=base_x, y=base_y+base_height, width=base_width)
class REDCapTools(tk.Tk): def __init__(self, *args, **kwargs): tk.Tk.__init__(self, *args, **kwargs) container = tk.Frame(self) container.pack() self.title('REDCapTools Menu') self.resizable(width=False, height=False) self.set_styles() frames = self.frames = {} frames["MainMenu"] = MainMenu(container, self) #frames["ChartMaker"] = ChartMaker(container, self) frames["MonthlyAssessment"] = MonthlyAssessment(container, self) frames["CSVFormatter"] = CSVFormatter(container, self) #frames["ChartMakerSettings"] = ChartMakerSettings(container, self) frames["MonthlyAssessSettings"] = MonthlyAssessSettings( container, self) for name, ins in self.frames.items(): ins.grid(row=0, column=0, sticky="nsew") self.show_frame("MainMenu") def show_frame(self, frame_name): frame = self.frames[frame_name] self.title(frame.title) frame.tkraise() def set_styles(self): self.style = ThemedStyle(self) self.style.theme_use("arc") def quit(self, event=None): sys.exit()
def __init__(self, parent, title=None, cancellable=False, enter_to_apply=True): tk.Toplevel.__init__(self, parent) self.enter_to_apply = enter_to_apply self.transient(parent) self.wm_resizable(height=False, width=False) self.cancellable = cancellable if title: self.title(title) style = ThemedStyle(self) if darkmode: style.set_theme("black") self.parent = parent self.result = None body = ttk.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, if1, if2, fullscreen): # 1: Create a builder self.builder = builder = pygubu.Builder() # 2: Load an ui file builder.add_from_file(os.path.join(CURRENT_DIR, 'netmon.ui')) # 3: Create the toplevel widget. self.mainwindow = builder.get_object('mainwindow') #4: connect callbacks self.builder.connect_callbacks(self) # 5: optional fullscreen if (fullscreen): self.mainwindow.attributes("-fullscreen", True) # 6: prepare styling self.style = ThemedStyle(self.mainwindow) self.current_style = 'radiance' self.alarm = False # set interface vars & update ui self.if1 = if1 self.builder.get_object('if1_labelframe').config(text=if1) self.if2 = if2 self.builder.get_object('if2_labelframe').config(text=if2) # bind ui-vars to local-vars self.dateVar = self.builder.get_variable('dateVar') self.timeVar = self.builder.get_variable('timeVar') self.if1ipVar = self.builder.get_variable('if1ipVar') self.if1rxVar = self.builder.get_variable('if1rxVar') self.if1TputVar = self.builder.get_variable('if1TputVar') self.if2ipVar = self.builder.get_variable('if2ipVar') self.if2rxVar = self.builder.get_variable('if2rxVar') self.if2TputVar = self.builder.get_variable('if2TputVar')
def __init__(self, master=None): super().__init__(master) self.style = ThemedStyle(self) self.style.set_theme('elegance') self.iconbitmap(r'data\app.ico') self.minsize(450, 300) self.title('WoT Battle Counter') self.menu_bar = Menu(self) self.content = Frame(self) self.entry = Entry(self.content) self.player_list = Listbox(self.content) self.count_button = Button(self) self.scrollbar = Scrollbar(self.content) self.buttons_frame = Frame(self) self.sort_button = Checkbutton(self.buttons_frame) self.progressbar = Progressbar(self.buttons_frame) self.sort_variable = IntVar(self) self.PlayerObjects = [] self.replays = [] self.player_names = [] self.offset = 0 self.skirmish_value = 1 self.advance_value = 1 self.clan_war_value = 3
def __init__(self, window, window_title, video_source=0): self.window = window self.window.title = window_title self.style = ThemedStyle(window) self.style.set_theme("breeze") self.video_source = video_source #open vid source self.vid = VideoCapture(video_source) #canvas for video render self.canvas = tkinter.Canvas(window, width=self.vid.width / 2, height=self.vid.height / 2) self.canvas.pack() self.btn_snapshot = ttk.Button(window, text="Scan", command=self.snapshot) self.btn_snapshot.pack(anchor=tkinter.CENTER, expand=True) self.stext = ScrolledText(window, width=50, height=10) self.stext.pack(anchor=tkinter.CENTER, expand=True) self.stext_clear = ttk.Button(window, text="clear", command=self.clear) self.stext_clear.pack(anchor=tkinter.CENTER) self.export_file = ttk.Button(window, text="export", command=self.export) self.export_file.pack(anchor=tkinter.CENTER) self.delay = 15 self.update() self.window.mainloop()
def __init__(self, parent=None): super(UI, self).__init__(parent) self.parent = parent style = ThemedStyle(parent) style.set_theme("arc") self.parent.geometry("480x520") self.init_ui()
def __init__(self): self.root = Tk() width = self.root.winfo_screenwidth() height = self.root.winfo_screenheight() self.root.geometry("660x340+" + str(int((width - 660) / 2)) + "+" + str(int((height - 340) / 2))) style = ThemedStyle(self.root) style.set_theme("radiance") a = 5 self.a = False self.b = False self.c = False self.studentListPath = None textFrame=tk.Frame(self.root) textFrame.grid(row=0,column=0,sticky=E) self.text = Text(textFrame,height=3,width=73,bg=self.root["background"],relief=tk.FLAT,wrap="word",font="Ubuntu 12") self.text.insert(INSERT," Welcome to the Poll Analyzer! Load the student list, poll files and answer sheets") self.text.configure(state=DISABLED) self.text.tag_configure("right", justify="right") self.text.grid(pady=(20,0),padx=16,sticky=W+E+S) barFrame = tk.Frame(self.root) barFrame.grid(row=4, column=0, sticky="we", padx=20) self.bar = Progressbar(barFrame, orient=HORIZONTAL,length=597, mode="determinate", maximum=100) self.bar.grid(pady=20) startEndButFrame=tk.Frame(self.root) startEndButFrame.grid(row=5,column=0,sticky=E,padx=70) self.buttonEnd = Button(startEndButFrame, text="Cancel", command=self.cancel) self.buttonEnd.pack(side="right", padx=5, pady=5) self.buttonStart = Button(startEndButFrame, text="Start", command=self.start, state=DISABLED) self.buttonStart.pack(side="left",padx=5, pady=5) browseButFrame = tk.Frame(self.root) browseButFrame.grid(row=1, column=0, sticky=W + E + N) self.combo1 = ttk.Combobox(browseButFrame, height="10", width="63") self.combo1.grid(row=1, column=2) self.combo2 = ttk.Combobox(browseButFrame, height="10", width="63") self.combo2.grid(row=2, column=2) self.combo3 = ttk.Combobox(browseButFrame, height="10", width="63") self.combo3.grid(row=3, column=2) self.button_explore = Button(browseButFrame,text="Browse Student List",command=self.browseFiles) self.button_explore.grid(row=1,column=0,padx=5) self.button_explore2 = Button(browseButFrame,text="Browse Poll Reports",command=self.browseFiles2) self.button_explore2.grid(row=2,column=0, padx=20, pady=5) self.button_explore3 = Button(browseButFrame,text="Browse Answer Key",command=self.browseFiles3) self.button_explore3.grid(row=3,column=0, padx=20, pady=5) list1=1 list2=2 self.root.mainloop()
def main(): window = Tk() window.title("Greedy Bee") style = ThemedStyle(window) style.set_theme("arc") App = Application(window) window.mainloop()
def memoryMonitor(): MemoryMonitor = Tk() appStyle = ThemedStyle(MemoryMonitor) appStyle.set_theme("plastik") MemoryMonitor.iconbitmap(default=ICON_PATH) MemoryMonitor.title("Memory Monitor") MemoryMonitor.resizable(width=False, height=False) MemoryMonitor.minsize(width=570, height=510) MemoryMonitor.mainloop()
def add_book_dialog(self): ''' Add new book dialog box ''' try: self.msg["text"] = "" self.tl = Tk() # Setting Theme style = ThemedStyle(self.tl) style.set_theme("plastik") self.tl.title("Add book") self.tl.resizable(False, False) # window position x = root.winfo_rootx() + 150 y = root.winfo_rooty() + 50 self.tl.geometry('+%d+%d' % (x, y)) Label(self.tl, text='Author').grid(row=0, column=0, sticky=W + E) ne1var = StringVar() ne1 = ttk.Entry(self.tl, textvariable=ne1var) ne1.grid(row=0, column=1, sticky=W) ne1.insert(0, "") Label(self.tl, text='Title').grid(row=1, column=0, sticky=W + E) ne2var = StringVar() ne2 = ttk.Entry(self.tl, textvariable=ne2var) ne2.grid(row=1, column=1, sticky=W) ne2.insert(0, "") Label(self.tl, text='Pages').grid(row=2, column=0, sticky=W + E) ne3var = StringVar() ne3 = ttk.Entry(self.tl, textvariable=ne3var) ne3.grid(row=2, column=1, sticky=W) ne3.insert(0, "") Label(self.tl, text='Date').grid(row=3, column=0, sticky=W + E) ne4var = StringVar() ne4 = ttk.Entry(self.tl, textvariable=ne4var) ne4.grid(row=3, column=1, sticky=W) ne4.insert(0, "") # Button calls function for executing sql command upbtn = ttk.Button( self.tl, text='Add new book', command=lambda: self.add_book(ne1, ne2, ne3, ne4)) upbtn.grid(row=5, column=0, sticky=W, pady=10, padx=10) self.config() self.tl.protocol("WM_DELETE_WINDOW", self.config) self.tl.mainloop() except IndexError as e: self.msg["text"] = "Error while adding a book"
def __init__(self, parent, *args, **kwargs): tk.Frame.__init__(self, parent, *args, **kwargs) self.parent = parent self.database = Database() parent.title("Music Player") parent.geometry("1000x600") style = ThemedStyle(parent) style.set_theme("scidgrey")
def create_ttk_styles(self, the_root): # { # TRY THE FOLLOWING try: # { self.style = ThemedStyle(the_root) # STYLE THEME self.style.set_theme("kroc") # keramik, arc # } except: # { pass
def create_ttk_styles(self, the_root): # { # TRY THE FOLLOWING try: # { # CONFIGURE THE TTK STYLE self.style = ThemedStyle(the_root) # STYLE THEME self.style.set_theme("radiance") # } except:# { pass
def set_window_frame(self): """ window configuration - title & size """ self.window.title('TRIPLET CHECKER') self.window.geometry('900x600+200+200') self.window.resizable(False, False) # theme setting style = ThemedStyle(self.window) style.set_theme('breeze')
def set_app_style(self): self.style = ThemedStyle(self.master) self.style.set_theme('black') # self.style.theme_settings('equilux', {"TNotebook.Tab": {"configure": {"padding": [30, 15]}}}) # self.style.theme_settings('equilux', {'TButton': {"configure": {"padding": [30, 15]}}}) self.style.map("TButton", foreground=[('pressed', 'white'), ('active', 'white')], background=[('pressed', '!disabled', 'gray60'), ('active', 'gray50')])
def __init__(self): super().__init__(className='fantasticFilter') ''' ========== Locks ========== ''' self.resize_lock = td.Lock() self.resizing = False ''' ======= Tk widgets ======== ''' self.style = ttk.Style() self.frame_main_left = None self.frame_main_center = None self.frame_main_right = None self.show_origin_btn = None self.show_enhanced_btn = None self.canvas: ResizingCanvas = None self.enhance_pb = None self.start_enhance_btn = None self.input_resize_height = None self.input_resize_width = None ''' ========= Tk flags ======== ''' self._model_path_obj = tk.StringVar(self) self.main_right_model_label = tk.StringVar(self) self.main_right_model_label.set("使用模型:<無>") self._vignette_scale = 1 self._vignette_should_update = False self._vignette_lock = RLock() ''' ======== neuronal ========= ''' self._model = Enhancer() ''' ===== internal flags ====== ''' self._model_loaded = self._model.model_available self._image_loaded = lambda: self._main_image_origin is not None self.status_text = tk.StringVar(self) self.resize_width = tk.StringVar(self) self.resize_width.trace("w", self._resize_width_listener) self.resize_height = tk.StringVar(self) self.resize_height.trace("w", self._resize_height_listener) self.status_text.set("就緒") ''' ===== np array images ===== ''' self._main_image_origin = None self._main_image_current_clean = None self._main_image_enhanced = None ''' ========== theme ========== ''' try: from ttkthemes import ThemedStyle style = ThemedStyle(self) style.set_theme("arc") except ImportError as e: class ThemedStyle: pass ''' ====== configuration ====== ''' self.model_dir = resource_path("pretrained/") self.vignette_handler()
def vp_start_gui(): '''Starting point when module is the main routine.''' global val, w, root root = tk.Tk() style = ThemedStyle(root) style.set_theme('breeze') test_support.set_Tk_var() top = Toplevel1(root) test_support.init(root, top) root.mainloop()
def debtpayment(): '''manages the gui part for debit card payement''' try: onlinepay.destroy() except: pass global debt debt = Toplevel() debt.title('Debit paygate') debts = ThemedStyle(debt) debts.set_theme(theme) debtlabelframe = tk.LabelFrame(debt, text="DEBIT PAYEMENT METHOD", font=('calibri', 10, 'italic')) debtlabelframe.pack(padx=15, pady=15) cardno = Label( debtlabelframe, text='Card Number:', ) cardno.grid(row=0, column=0, padx=10, pady=10) cardnoent = Entry(debtlabelframe) cardnoent.grid(row=0, column=1, padx=10, pady=10) expdate = Label( debtlabelframe, text='Expiry Date:', ) expdate.grid(row=1, column=0, padx=10, pady=10) expdateent = DateEntry(debtlabelframe, width=18) expdateent.grid(row=1, column=1, padx=10, pady=10) cardno = Label( debtlabelframe, text='CVV :', ) cardno.grid(row=2, column=0, padx=10, pady=10) cardnoent1 = Entry(debtlabelframe) cardnoent1.config(show='•') cardnoent1.grid(row=2, column=1, padx=10, pady=10) cardno = Label( debtlabelframe, text='Cardholder Name :', ) cardno.grid(row=3, column=0, padx=10, pady=10) cardnoent = Entry(debtlabelframe) cardnoent.bind("<Return>", lambda x: finalpay()) cardnoent.grid(row=3, column=1, padx=10, pady=10) paybt = Button(debtlabelframe, width=10, text="PAY", command=finalpay) paybt.grid(row=4, column=0, padx=10, pady=10) cancel = Button(debtlabelframe, width=10, text="CANCEL", command=debt.destroy) cancel.grid(row=4, column=1, padx=10, pady=10) debt.mainloop()
def pay(): '''this functions manages the payroot gui where the payment gates are there ''' global payroot, debpic, onlinepic, cashpic payroot = Toplevel() paroot = ThemedStyle(payroot) paroot.set_theme(theme) global pay_var pay_var = IntVar() debpic = PhotoImage(file='img//visa.gif') onlinepic = PhotoImage(file='img//sbi.gif') cashpic = PhotoImage(file='img//rs.gif') payroot.title('Payment Methods') paylabelframe = tk.LabelFrame(payroot, text='Payment', font=('calibri', 20, 'italic'), fg='green') paylabelframe.pack(padx=20, pady=20, ipadx=10, ipady=10) debit = Radiobutton(paylabelframe, variable=pay_var, text='DEBIT/CREDIT CARD', value=0) debit.grid(row=0, column=0) deblabel = Label(paylabelframe, image=debpic) deblabel.grid(row=0, column=1, padx=10) sbionline = Radiobutton(paylabelframe, variable=pay_var, text='NET BANKING ', value=1) sbionline.grid(row=1, column=0) sbilabel = Label(paylabelframe, image=onlinepic) sbilabel.grid(row=1, column=1, ipady=10, padx=10) cash = Radiobutton(paylabelframe, variable=pay_var, text='CASH ', value=2) cash.grid(row=2, column=0, padx=10) cashlabel = Label(paylabelframe, image=cashpic) cashlabel.grid(row=2, column=1, ipady=10, pady=10) proceed = Button(paylabelframe, width=10, text="PROCEED", command=pay_check) proceed.grid(row=3, column=0, padx=10, ipady=3, ipadx=3) cancel = Button(paylabelframe, width=10, text="CANCEL", command=payroot.destroy) cancel.grid(row=3, column=1, padx=10, ipady=3, ipadx=3) payroot.mainloop()
def __init__(self): Tk.__init__(self) self.title(string = "Login") self.resizable(0,0) #self.style = Style() #self.style.theme_use("clam") self.ttkStyle = ThemedStyle() self.ttkStyle.set_theme("arc") self.configure(background = 'white') if platform.system() == 'Darwin': icon = ImageTk.PhotoImage(Image.open('icon.png')) else: icon = PhotoImage(file='icon.png') #icon = PhotoImage(file='icon.png') # This only works on Linux and Windows self.tk.call('wm', 'iconphoto', self._w, icon) if platform.system() == 'Linux' or platform.system() == 'Darwin': self.eval('tk::PlaceWindow %s center' % self.winfo_pathname(self.winfo_id())) else: pass self.bind("<Escape>", self.exit) # Press ESC to quit app self.options = { 'username' : StringVar(), 'pwd' : StringVar(), 'reg_username' : StringVar(), 'reg_password' : StringVar(), 'reg_check_password' : StringVar(), } if platform.system() == 'Darwin': photo = ImageTk.PhotoImage(Image.open('images/login_img.png')) else: photo = PhotoImage(file='images/login_img.png') #photo = PhotoImage(file='images/login_img.png') # This only works on Linux and Windows #photo = photo.zoom(2) #photo = photo.subsample(1) label = Label(self, image=photo, background = 'white') label.image = photo # keep a reference! label.grid(row = 0, column = 0, columnspan = 2) Label(self, text = 'Username', background = 'white', foreground = 'black', font='Helvetica 12 bold').grid(row = 1, column = 0, sticky = 'w') self.a = Entry(self, textvariable = self.options['username'], width = 31) self.a.grid(row = 2, column = 0, columnspan = 2, sticky = 'w') self.a.focus() Label(self, text = 'Password', background = 'white', foreground = 'black', font='Helvetica 12 bold').grid(row = 3, column = 0, sticky = 'w') Entry(self, textvariable = self.options['pwd'], show = '*', width = 31).grid(row = 4, column = 0, columnspan = 2, sticky = 'w') login_clk = Button(self, text = 'Login', command = self.login, width = 30).grid(row = 5, column = 0, columnspan = 2, sticky = 'w') register_clk = Button(self, text = 'Register', command = self.register, width = 30).grid(row = 6, column = 0, columnspan = 2, sticky = 'w') close = Button(self, text = 'Exit', command = self.destroy, width = 30).grid(row = 7, column = 0, columnspan = 2, sticky = 'w') self.bind("<Return>", self.login_event) # Press ESC to quit app
def main(): root = tk.Tk() # change ttk style to something that looks decent style = ThemedStyle(root) style.set_theme("arc") gui = Gui(root) try: #gui.master.after(200, gui.draw) gui.mainloop() except KeyboardInterrupt: root.destroy() sys.exit()
def setup_styles(): from ttkthemes import ThemedStyle s = ThemedStyle() s.set_theme("default") style = ttk.Style() style.theme_use('elegance') # style.configure('Treeview', fieldbackground="#919191") style.configure('Treeview', fieldbackground="#595959") style.configure('.', background='#919191') style.configure('.', foreground='#111111') # style.configure('Treeview', font=('DejaVu Sans Mono', 11, 'bold')) style.configure('Treeview', font=('DejaVu Sans', 11, 'bold'))
def __init__(self, frames): # initialize UI # window self.window = tk.Tk() self.window.geometry("900x600") self.window.title("Earthquake Prediction Helper App") self.window.configure(bg="#ccd9ed") style = ThemedStyle(self.window) style.set_theme('arc') menu = tk.Menu(self.window) self.window.config(menu=menu) file_menu = tk.Menu(menu, tearoff=0) file_menu.add_command(label="Exit") menu.add_cascade(label="File", menu=file_menu) help_menu = tk.Menu(menu, tearoff=0) help_menu.add_command(label="About", command=self.open_help) help_menu.add_command(label="Explore Dataset", command=self.eda) menu.add_cascade(label="Help", menu=help_menu) # status bar on the bottom self.var = tk.StringVar(self.window) self.var.set("Application initialized successfully!") s = ttk.Style() s.configure("new.TLabel", foreground="#000000", background="#ccd9ed") self.status_bar = ttk.Label(self.window, textvariable=self.var, style="new.TLabel", anchor=tk.W) self.status_bar.pack(side=tk.BOTTOM, fill=tk.X, padx=10, pady=10) # main container self.main_frame = ttk.Frame(self.window) self.main_frame.pack(anchor=tk.NW, expand=True, fill=tk.BOTH) # init shared object self.shared_obj = SharedObject(self.var, self.window) # frame on the left f = frames[0](self.main_frame, self.shared_obj) f.pack(side=tk.LEFT, fill=tk.BOTH, expand=True) # separator sep = ttk.Separator(self.main_frame, orient=tk.VERTICAL) sep.pack(side=tk.LEFT, fill=tk.Y) # frame on the right f = frames[1](self.main_frame, self.shared_obj) f.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)
def test_custom_theme(self): if not ThemedStyle().png_support: return for theme in ThemedStyle.pixmap_themes: window = tk.Tk() style = ThemedStyle(window) style.set_theme_advanced(theme, brightness=0.2, saturation=1.3, hue=1.4) window.destroy() return