def __init__(self, theme="arc"): """ :param theme: Theme to show off """ ThemedTk.__init__(self) self.set_theme(theme) # Create widgets self.label = ttk.Label(self, text="This is an example label.") self.dropdown = ttk.OptionMenu(self, tk.StringVar(), "First value") self.entry = ttk.Entry( self, textvariable=tk.StringVar(value="Default entry value.")) self.button = ttk.Button(self, text="Button") self.radio_one = ttk.Radiobutton(self, text="Radio one") self.radio_two = ttk.Radiobutton(self, text="Radio two") self.scroll = ttk.Scrollbar(self, orient=tk.VERTICAL) self.checked = ttk.Checkbutton(self, text="Checked", variable=tk.BooleanVar(value=True)) self.unchecked = ttk.Checkbutton(self, text="Unchecked") self.tree = ttk.Treeview(self, height=4, show=("tree", )) self.setup_tree() self.scale_entry = ScaleEntry(self, from_=0, to=50, orient=tk.HORIZONTAL, compound=tk.RIGHT) self.combo = AutocompleteCombobox( self, completevalues=["something", "something else"]) # Grid widgets self.grid_widgets() # Bind screenshot button self.bind("<F10>", self.screenshot)
def __init__(self): ThemedTk.__init__(self, background=True, theme="breeze") load_dotenv() self.title(os.getenv("APP_TITLE")) self.iconbitmap('images/icon.ico') # self.state('zoomed') self.minsize(960, 550) self.geometry("1024x550") container = ttk.Frame(self) container.pack(side="top", fill="both", expand=True) container.grid_rowconfigure(0, weight=1) container.grid_columnconfigure(0, weight=1) self.frames = {} lst_table = fn.getMenuItems() lst_table.append('empty') for tbl in lst_table: frame = Panel(container, self, tbl) self.frames[tbl] = frame frame.grid(row=0, column=0, sticky="nsew") self.show_frame("dashboard")
def __init__(self): ThemedTk.__init__(self, theme='arc') # Window styling self.geometry('1024x768') img = ImageTk.PhotoImage(Image.open('source/notepad.ico')) self.tk.call('wm', 'iconphoto', self._w, img) self.tk.call('wm', 'title', self._w, 'Notepad') # Custom Styles Style().configure('green.TButton', background='green', higlightbackground='green', foreground='green') Style().configure('orange.TButton', background='orange', higlightbackground='orange', foreground='orange') Style().configure('red.TButton', background='red', higlightbackground='red', foreground='red') Style().configure('yellow.TButton', background='yellow', higlightbackground='yellow') self.padding = 5 self._frame = None self.switch_frame(IndexPage)
def __init__(self, frame, title, theme="yaru", user_data=None): """ Constructor for RootWindow Args: frame: Frame to be contained in window. title: Window title. theme: Overall theme. user_data: If it is not None, it is supplied in DashboardFrame Constructor. Returns: None """ ThemedTk.__init__(self, theme=theme, background=True) self._frame = None self._user_data = None self._theme = theme if user_data is not None: self._frame = frame(self, user_data) self._user_data = user_data else: self._frame = frame(self) self._frame.grid(row=0, column=0) self.title(title) self.iconphoto( False, tk.PhotoImage(file=pathlib.Path("assets/icon.png")) ) self.resizable(0, 0)
def __init__(self, *args, **kwargs): ThemedTk.__init__(self, *args, **kwargs) self.title('PDF Tool') self.s = ttk.Style() self.s.configure("BSelect.TButton", font=('Helvetica', '12', 'bold')) self.s.configure("BConvert.TButton", font=('Helvetica', '14', 'bold')) self.button_select = ButtonSelect() self.b_select_folder() self.b_select_file() self.info_label(dir_text) self.frame = SetupBox() self.frame.grid(row=2, column=0, columnspan=2, padx=20, pady=10)
def __init__(self): ThemedTk.__init__(self, themebg=True) global path print(sys.version_info.major) self.container = tk.Frame(self) self.container.pack(side="top", fill="both", expand=True) self.container.grid_columnconfigure(0, weight=1) self.frame1 = tk.Frame(self.container) self.frame1.grid_propagate(False) self.frame1.grid(row=0) frame = tk.LabelFrame(self.frame1, text=" Login ", font=("Arial 9 bold"), padx=100, pady=15) frame.pack(padx=20, pady=20) tk.Label(frame, text="Username", font=("Arial 9 bold")).pack() self.username = tk.Entry(frame, width=25, relief="flat", font=("Arial 10")) self.username.pack() tk.Label(frame, text="Password", font=("Arial 9 bold")).pack() self.password = tk.Entry(frame, width=25, relief="flat", font=("Arial 10")) self.password.pack() tk.Label(frame, text="").pack() b1 = tk.Button(frame, text="Login", padx=74, pady=5, font=("Arial 10 bold"), border=0, command=lambda: self.authorize()).pack() tk.Label(frame, text="").pack() b2 = tk.Button(frame, text="Exit", padx=80, pady=5, font=("Arial 10 bold"), border=0).pack() tk.Label(frame, text="").pack()
def __init__(self): ThemedTk.__init__(self, theme='black') self.title('Обновление F_Reference_H') self.geometry('500x140') x = (self.winfo_screenwidth() - self.winfo_reqwidth()) / 2 y = (self.winfo_screenheight() - self.winfo_reqheight()) / 2 self.wm_geometry("+%d+%d" % (x - 150, y)) self.resizable(width=False, height=False) self.iconphoto(True, PhotoImage(file='settings/ico/ico_main.png')) flow_hack_png = Image.open(f'settings/ico/mini_flowhack.png') flow_hack_png = ImageTk.PhotoImage(flow_hack_png) self.frame = Frame(self) self.frame.place(relwidth=1, relheight=1) flow_1 = Label(self.frame, image=flow_hack_png, cursor='heart') flow_1.bind('<Button-1>', lambda no_matter: webopen(VK)) flow_1.place(relx=.09, rely=.085, anchor='center') flow_2 = Label(self.frame, image=flow_hack_png, cursor='heart') flow_2.bind('<Button-1>', lambda no_matter: webopen(VK)) flow_2.place(relx=.91, rely=.085, anchor='center') self.lbl_done = Label(self.frame, text='ОБНОВЛЕНИЕ', font=('Times New Roman', 12, 'bold italic')) self.lbl_done.place(relx=.5, rely=.1, anchor='c') self.lable_second = Label( self.frame, text='Нам понадобится интернет!\nМы всё сделаем сами, это не ' 'займё много времени!', font=('Times New Roman', 10, 'bold italic'), justify='center') self.lable_second.place(relx=.5, rely=.35, anchor='c') self.btn_update = Button(self.frame, text='Обновить', cursor='hand1', command=self.updater_window) self.btn_update.place(relx=.5, rely=.65, anchor='c') self.license = Label( self.frame, cursor='hand1', text='Нажимая "Обновить" вы принимаете лицензионное соглашение', font=('Times New Roman', 10, 'bold italic'), foreground='black') self.license.bind('<Button-1>', lambda no_matter: webopen(SAIT)) self.license.place(relx=.5, rely=.92, anchor='c') self.mainloop()
def __init__(self): ThemedTk.__init__(self) self.iconbitmap('pomodoro_icon.ico') self.resizable(False, False) self.set_theme('radiance') self.style = Style() self.style.configure('.', font=('Times', 13), takfocus=0, xpad=10) self.style.configure('TFrame', background='#471d0f') self.style.configure('TButton', 'Button.focus' == {'sticky': '0'}) print(self.style.layout('TButton')) self.title('Pomodoro') self.protocol("WM_DELETE_WINDOW", self.quit_event) self.note = Notebook(self) self.page_one = Page1(self.note) self.page_two = Page2(self.note) self.page_three = Page3(self.note)
def __init__(self,display=True): ''' Initializes the GUI instance. display=True runs the Tk.__init__(self) command, while display=False skips that and visual initialization, keeping the GUI 'hidden' ''' self.display=display self.sf_path=os.path.join(os.path.dirname(os.path.abspath(__file__)),'anthem_soundfonts') if not os.path.isdir(self.sf_path): print('Initializing soundfont library...') os.mkdir(self.sf_path) gdd.download_file_from_google_drive(file_id=sound_font,dest_path=\ os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)),'anthem_soundfonts'),'font.sf2'),showsize=True) if self.display: ThemedTk.__init__(self) self.set_theme('clearlooks') self.initGUI()
def __init__(self, theme="arc"): """ :param theme: Theme to show off """ ThemedTk.__init__(self, fonts=True, themebg=True) self.set_theme(theme) # Create widgets self.notebook = ttk.Notebook(self) self.notebook.add(ttk.Button(self, text="Hello World"), text="Frame One") self.notebook.add(ttk.Button(self, text="Hello Universe"), text="Frame Two") self.menu = tk.Menu(self, tearoff=False) self.sub_menu = tk.Menu(self.menu, tearoff=False) self.sub_menu.add_command(label="Exit", command=self.destroy) self.menu.add_cascade(menu=self.sub_menu, label="General") self.config(menu=self.menu) self.label = ttk.Label(self, text="This is an example label.") self.dropdown = ttk.OptionMenu(self, tk.StringVar(), "First value", "Second Value") self.entry = ttk.Entry( self, textvariable=tk.StringVar(value="Default entry value.")) self.button = ttk.Button(self, text="Button") self.radio_one = ttk.Radiobutton(self, text="Radio one", value=True) self.radio_two = ttk.Radiobutton(self, text="Radio two", value=False) self.scroll = ttk.Scrollbar(self, orient=tk.VERTICAL) self.checked = ttk.Checkbutton(self, text="Checked", variable=tk.BooleanVar(value=True)) self.unchecked = ttk.Checkbutton(self, text="Unchecked") self.tree = ttk.Treeview(self, height=4, show=("tree", "headings")) self.setup_tree() self.scale_entry = ScaleEntry(self, from_=0, to=50, orient=tk.HORIZONTAL, compound=tk.RIGHT) self.combo = AutocompleteCombobox( self, completevalues=["something", "something else"]) self.progress = ttk.Progressbar(self, maximum=100, value=50) # Grid widgets self.grid_widgets() # Bind screenshot button self.bind("<F10>", self.screenshot) self.bind("<F9>", self.screenshot_themes)
def __init__(self): ThemedTk.__init__(self) if platform.system() is 'Windows': self.set_theme("vista") else: self.set_theme("clearlooks") self.set_title() img = ImageTk.PhotoImage(file=Path(__file__).resolve().parent / 'images' / 'icon.png') self.iconphoto(True, img) self.menu_bar = MenuBar(self) self.config(menu=self.menu_bar) self.rowconfigure(0, weight=1) self.columnconfigure(1, weight=1) self.minutiae = [] self.file_path = Path() self.image_raw = Image.new('RGBA', (512, 512), (255, 255, 255, 255)) self.image_fingerprint = self.image_raw self.image_minutiae = None self.image = ImageTk.PhotoImage(self.image_raw) self.image_canvas = Canvas(self, bd=0, highlightthickness=0) self.image_canvas.create_image(0, 0, image=self.image, anchor=N + W, tags="IMG") self.image_canvas.grid(row=0, column=1, sticky=NSEW) self.notebook = Notebook(self) self.notebook.grid(row=0, column=0, sticky=NSEW) self.tabs = [ MindtctFrame(self, self.load_fingerprint_image), MinutiaeEditorFrame(self, self.load_fingerprint_image, self.load_minutiae_file, self.save_minutiae_file) ] self.notebook.add(self.tabs[0], text="MINDTCT") self.notebook.add(self.tabs[1], text="Minutiae Editor") self.image_canvas.bind("<Button-1>", self.on_canvas_mouse_left_click) self.image_canvas.bind("<Control-Button-1>", self.on_canvas_ctrl_mouse_left_click) self.image_canvas.bind("<B1-Motion>", self.on_canvas_mouse_left_drag) self.image_canvas.bind("<ButtonRelease-1>", self.on_canvas_mouse_left_release) self.image_canvas.bind("<Button-3>", self.on_canvas_mouse_right_click) self.bind("<Configure>", self.redraw)
def __init__(self, controlador, *args, **kwargs): """ Constructor de la GUI """ ThemedTk.__init__(self, *args, *kwargs) self.controlador = controlador self.controlador.vista = self self.recurso = None self.getScreenSize() geometry = "751x688+" geometry += str(int(self.ancho / 2) - 375) + "+" geometry += str(int(self.alto / 2) - 344) self.geometry(geometry) self.resizable(0, 0) self.title("Downloader") self.config(bg='white') self.iconbitmap('descarga.ico') self.set_theme("arc") self.config(bg='#4C4C4D') self.iniciaComponentes()
def __init__(self, *args, **kwargs): ThemedTk.__init__(self, theme="equilux") restaurant_name = kwargs.get("restaurant_name") rest_img = kwargs.get("restaurant_image") self.articles = { "Fried Potatoes": 4, "Chicken Burger": 8, "Waffles": 3.5, "Chicken Royal Salad": 10, "Veggie Salad": 9, } self.operands = ["+", "-", "*", "/"] self.currency = "$" self.restaurant_name = restaurant_name or "Le petit français" self.calc = ScientCalc() self.bg_color = "#252525" self.fullscreen = False self.logo_path = None self.food_img = None self.entries = [] self.calc_buttons = [] self.operand_buttons = [] self.low_calc_buttons = [] self.control_buttons = [] # Trying to minimize class attributes self.rand_widget_dict = {} # {text : (label, entry) self.food_widgets = {} self.total_widgets = {} self.article_widgets = {} # {entry: (button +, button -)} self.entry_buttons = {} self.x = 0 self.y = 0 self._width = 1028 self._height = 500 self._init_ui(rest_img)
def __init__(self, theme = 'default'): """ Initialisierung des Mainframes. Stylekonfiguration Initialisierung und bindung der Subframes. Parameters ---------- theme : str, optional, default='default' Das ttk Theme. """ ThemedTk.__init__(self) #Default ist Anon self.nickname="Anon" #title of window self.wm_title("Hochschul Chat") #style self.set_theme(theme) #print(self.get_themes()) # zeigt verfügbare themes #für toplevel settings, verhindert mehrere Fenster self.settings_already_opend = False #Hintergrund self.configure(background = "ghost white") self.update() self.create_widgets() #tk variable für die settings. wir brauchen zwei variabeln weil wenn # wir im thread auf die tk variable prüfen # kann es sein dass der thread startet oder stoppt bevor ok gedrückt # wurde und das wäre nicht userfreundlich und könnte problematisch werden self.auto_refresh_checked_settings = tk.BooleanVar() self.auto_refresh_checked_settings.set(False) # Die gesonderte Threadvariable. Der Thread checkt hier ob er wirklich noch # refreshen soll. wird nur verändert durch ein drücken auf ok in den settings self.keep_refreshing = False self.auto_update_thread = Thread(target=self.run_auto_update) self.protocol("WM_DELETE_WINDOW", self.quit)
def __init__(self, theme="arc"): """ :param theme: Theme to show off """ ThemedTk.__init__(self) self.set_theme(theme) # Create widgets self.label = ttk.Label(self, text="This is an example label.") self.dropdown = ttk.OptionMenu(self, tk.StringVar(), "First value") self.entry = ttk.Entry(self, textvariable=tk.StringVar(value="Default entry value.")) self.button = ttk.Button(self, text="Button") self.radio_one = ttk.Radiobutton(self, text="Radio one") self.radio_two = ttk.Radiobutton(self, text="Radio two") self.scroll = ttk.Scrollbar(self, orient=tk.VERTICAL) self.checked = ttk.Checkbutton(self, text="Checked", variable=tk.BooleanVar(value=True)) self.unchecked = ttk.Checkbutton(self, text="Unchecked") # Grid widgets self.grid_widgets() # Bind screenshot button self.bind("<F10>", self.screenshot)
def __init__(self, move_files, restore_all, settings, *args, **kwargs): ThemedTk.__init__(self, *args, **kwargs) self.auto_update_var = IntVar() self.dark_mode_var = IntVar() self.log_save_var = IntVar() self.settings = settings self.update = update self.move_files = move_files self.restore_all = restore_all # Setup Window self.title("UPK Manager for Blade & Soul v" + version) if self.current_theme == "equilux": self.bg_color = "#464646" elif self.current_theme == "arc": self.bg_color = "#F5F5F5" else: self.bg_color = "" self.config(background=self.bg_color) self.font_style = "Candara 11 bold" self.geometry("+700+300") self.resizable(0, 0) if path.isfile("upk_manager.ico"): self.iconbitmap(bitmap="upk_manager.ico") # Setup Container container = ttk.Frame(self) container.pack(side="top", fill="both", expand=True) container.grid_rowconfigure(0, weight=1) container.grid_columnconfigure(0, weight=1) # Setup Frame dict self.frames = {} for item in (MainFrame, SettingsFrame): frame = item(container, self) self.frames[item] = frame frame.grid(row=0, column=0, sticky="nesw") # Show default frame self.show_frame(MainFrame)
def __init__(self, raven: RavenClient): self.raven = variables.raven = raven self.width = 800 if sys.platform != "linux" else 825 self.height = 425 if sys.platform != "linux" else 450 # Initialize window ThemedTk.__init__(self) self.set_attributes() self.update_scaling() self.open_debug_window() self.finished = False variables.main_window = self self.style = ttk.Style() self.set_icon() self.set_variables() self.config_style() self.discord = DiscordClient() # Get the default path for CombatLogs and the Installation path self.default_path = variables.settings["parsing"]["path"] # Set window properties and create a splash screen from the splash_screen class self.withdraw() self.splash = BootSplash(self) self.splash.label_var.set("Building widgets...") self.protocol("WM_DELETE_WINDOW", self.exit) # Add a notebook widget with various tabs for the various functions self.notebook = ttk.Notebook(self, height=420, width=self.width) self.file_tab_frame = ttk.Frame(self.notebook) self.realtime_tab_frame = ttk.Frame(self.notebook) self.settings_tab_frame = ttk.Frame(self.notebook) self.characters_frame = CharactersFrame(self.notebook, self) self.file_select_frame = FileFrame(self.file_tab_frame, self) self.middle_frame = StatsFrame(self.file_tab_frame, self) self.ship_frame = ShipFrame(self.middle_frame.notebook) self.middle_frame.notebook.add(self.ship_frame, text="Ship") self.realtime_frame = RealTimeFrame(self.realtime_tab_frame, self) self.settings_frame = SettingsFrame(self.settings_tab_frame, self) self.builds_frame = BuildsFrame(self.notebook, self) self.toolsframe = ToolsFrame(self.notebook) self.strategies_frame = StrategiesFrame(self.notebook) self.chat_frame = ChatFrame(self.notebook, self) # Pack the frames and put their widgets into place self.grid_widgets() self.child_grid_widgets() # Add the frames to the Notebook self.setup_notebook() # Update the files in the file_select frame self.splash.label_var.set("Parsing files...") self.notebook.grid(column=0, row=0, padx=2, pady=2) self.file_select_frame.update_files() self.settings_frame.update_settings() # Check for updates self.splash.label_var.set("Checking for updates...") self.update() check_update() # Synchronize with Discord Bot Server if settings["sharing"]["enabled"] is True: self.splash.label_var.set("Synchronizing with Discord Bot Server...") self.update() self.discord.send_files(self) # Discord Rich Presence if settings["realtime"]["drp"] is True: self.rpc = Presence(436173115064713216) try: self.rpc.connect() except Exception: messagebox.showwarning("Error", "Discord Rich Presence failed to connect.") self.rpc = None else: self.rpc = None self.update_presence() # Give focus to the main window self.deiconify() self.finished = True self.splash.destroy() self.splash = None
def __init__(self): ThemedTk.__init__(self, theme='black') self.title('Установщик F_Reference_H') self.geometry('500x200') x = (self.winfo_screenwidth() - self.winfo_reqwidth()) / 2 y = (self.winfo_screenheight() - self.winfo_reqheight()) / 2 self.wm_geometry("+%d+%d" % (x - 150, y - 20)) self.resizable(width=False, height=False) self.iconphoto( True, PhotoImage(file='bin/ico/ico_main.png') ) flow_hack_png = Image.open(f'bin/ico/max_flowhack.png') flow_hack_png = ImageTk.PhotoImage(flow_hack_png) browse_png = Image.open(f'bin/ico/browse.png') browse_png = ImageTk.PhotoImage(browse_png) self.frame = Frame(self) self.frame.place(relwidth=1, relheight=1) self.url = '' self._path = getcwd() flow_hack_label = Label( self.frame, image=flow_hack_png, cursor='heart' ) flow_hack_label.bind('<Button-1>', open_web) flow_hack_label.place(anchor='c', relx=.5, rely=.1) self.check_icon = BooleanVar() self.check_icon.set(bool(True)) Checkbutton( self.frame, text='Создать ярлык на рабочем столе', var=self.check_icon, cursor='cross' ).place(relx=.5, y=60, anchor='c') Label( self.frame, text='Выберите папку для установки', font=('Times New Roman', 10, 'bold italic') ).place(relx=.5, rely=.485, anchor='c') self.input_url = Entry( self.frame, state=DISABLED, font=('Times New Roman', 9, 'bold italic'), foreground='black' ) self.input_url.place( rely=.6, relx=.5, height=20, relwidth=.7, anchor='c' ) Button( self.frame, image=browse_png, cursor='hand1', command=self.directory ).place(relx=.86, rely=.455) Button( self.frame, image=browse_png, cursor='hand1', command=self.directory ).place(relx=.045, rely=.455) Button( self.frame, text='Установить', cursor='hand1', command=self.install ).place(relx=.5, rely=.75, anchor='c') self.license = Label( self.frame, text='Для подтверждения согласия с лицензионным ' 'соглашением\nНажмите на "Установить" правой кнопкой мыши', font=('Times New Roman', 9, 'bold italic'), foreground='black', cursor='hand1', justify='center' ) self.license.bind( '<Button-1>', lambda no_matter: webopen('https://flowhack.github.io/') ) self.license.place(relx=.5, rely=.93, anchor='c') self.mainloop()
def __init__(self): ThemedTk.__init__(self, themebg=True) container = tk.Frame(self) container.pack(side="top", fill="both", expand=True) container.grid_columnconfigure(0, weight=1) label_frame = tk.Frame(container, borderwidth=5, width=1366, height=60, highlightcolor="black", highlightthickness=2) label_frame.grid_columnconfigure(0, weight=1) label_frame.grid(row=0, column=0, columnspan=2) label_frame.grid_propagate(False) label_frame.config(background="#f5f5f5") current_path = os.getcwd() self.label = ttk.Label(label_frame, text="Current Path", font=("Helvetica", 14, 'bold')) self.label.grid(row=0, column=0) self.label1 = ttk.Label(label_frame, text=current_path, font=("Helvetica", 12)) self.label1.grid(row=1, column=0) label_frame_bottom = tk.Frame(container, borderwidth=5, width=1366, height=50, highlightcolor="black", highlightthickness=2) label_frame_bottom.grid_columnconfigure(0, weight=1) label_frame_bottom.grid(row=2, column=0, columnspan=2) label_frame_bottom.grid_propagate(False) label_frame_bottom.config(background="#f5f5f5") self.label_bottom = ttk.Label(label_frame_bottom, text="Created by Logical4io", font=("Helvetica", 14, 'bold')) self.label_bottom.grid(row=0, column=0, pady=10) files_frame = tk.Frame(container, borderwidth=5, width=500, height=570, highlightcolor="black", highlightthickness=2) files_frame.grid_columnconfigure(0, weight=1) files_frame.grid(row=1, column=1) files_frame.pack_propagate(False) files_frame.config(background="#f5f5f5") label_files = ttk.Label(files_frame, text="Process", font=("Helvetica", 12)) label_files.pack(side="top", pady=10) Process(files_frame).pack(side="left", fill="both", expand=False) menu = MenuBar(container, self) self.config(menu=menu.menu) self.frames = {} for F in (StartPage, PageOne, PageTwo, PageThree): frame = F(container, self) self.frames[F] = frame frame.config(background="white") frame.grid(row=1, column=0, sticky="nsew") self.show_frame(StartPage)