def __init__(self): super().__init__() self.title('Calculator') self.style = Style('darkly') self.style.configure('.', font='TkFixedFont 16') self.calc = Calculator(self) self.calc.pack(fill='both', expand='yes')
def __init__(self): super().__init__() self.title('Back Me Up') self.style = Style() self.style.configure('bg.TFrame', background=self.style.colors.inputbg) self.style.configure('bg.TLabel', background=self.style.colors.inputbg) self.bmu = BackMeUp(self, padding=2, style='bg.TFrame') self.bmu.pack(fill='both', expand='yes')
def __init__(self): super().__init__() self.style = Style() self.title('TTK Creator') self.geometry(f'819x543') self.frame = ttk.Frame(self) self.setup() # self.eval('tk::PlaceWindow . center') self.bind("<Insert>", self.get_bounding_box)
class Application(tkinter.Tk): def __init__(self): super().__init__() self.title('Calculator') self.style = Style('flatly') self.style.configure('.', font='TkFixedFont 16') self.calc = Calculator(self) self.calc.pack(fill='both', expand='yes')
def __init__(self): super().__init__() self.title('Media Player') self.style = Style() self.style.theme_use('minty') self.player = Player(self) self.player.pack(fill='both', expand='yes') self.style.configure('TButton', font='Helvetica 20') self.style.configure('header.TLabel', background=self.style.colors.border, padding=10)
def __init__(self): super().__init__() self.title('PC Cleaner') self.style = Style('superhero') self.cleaner = Cleaner(self) self.cleaner.pack(fill='both', expand='yes') # custom styles self.style.configure('header.TLabel', background=self.style.colors.secondary, foreground=self.style.colors.info) # do not allow window resizing self.resizable(False, False)
def __init__(self): super().__init__() self.title('Collapsing Frame') self.style = Style() cf = CollapsingFrame(self) cf.pack(fill='both') # option group 1 group1 = ttk.Frame(cf, padding=10) for x in range(5): ttk.Checkbutton(group1, text=f'Option {x + 1}').pack(fill='x') cf.add(group1, title='Option Group 1', style='primary.TButton') # option group 2 group2 = ttk.Frame(cf, padding=10) for x in range(5): ttk.Checkbutton(group2, text=f'Option {x + 1}').pack(fill='x') cf.add(group2, title='Option Group 2', style='danger.TButton') # option group 3 group3 = ttk.Frame(cf, padding=10) for x in range(5): ttk.Checkbutton(group3, text=f'Option {x + 1}').pack(fill='x') cf.add(group3, title='Option Group 3', style='success.TButton')
def __init__(self, master=None): super().__init__(master) self.green_icon = tk.PhotoImage(data=icons.green_led) self.neutral_icon = tk.PhotoImage(data=icons.neutral_led) self.yellow_icon = tk.PhotoImage(data=icons.yellow_led) self.alert_icon = tk.PhotoImage(data=icons.alert_triangle) self.sm_neutral_led = tk.PhotoImage(data=icons.sm_gray_led) self.sm_green_led = tk.PhotoImage(data=icons.sm_green_led) self.sm_yellow_led = tk.PhotoImage(data=icons.sm_yellow_led) # tk Vars initialization self.offset_option = tk.BooleanVar() self.min_max_var = tk.StringVar(value='- - - - - -') self.min_max_var.default = '- - - - - -' self.actual_min = tk.StringVar(value='- -') self.actual_max = tk.StringVar(value='- -') self.actual_min.default = '- -' self.actual_max.default = '- -' self.count_var = tk.StringVar(value='Count: 0') self.min_warning = tk.DoubleVar(0.0) self.max_warning = tk.DoubleVar(0.0) self.last_value = tk.StringVar(value='- - - - - -') self.units = tk.StringVar(value='mm') self.precision = tk.IntVar(value=2) # validation callbacks self._validate_num = self.register(validate_number) self.tolerance_is_set = False self.grid_columnconfigure(0, weight=1) self.grid() # configure style self.style = Style(theme='cosmo') self.__create_widgets()
def test_radial_gauge(): """ Run a visual test """ # Create the main window root = tk.Tk() root.geometry('400x400') style = Style('minty') # Create the gauge widget gauge = RadialGauge(root, font='helvetica 14 bold', maximum=360, value=275, text='275 deg') gauge.pack(fill='both', expand='yes', padx=5, pady=20) gauge.variable.trace_add( 'write', lambda *args, g=gauge: g.textvariable.set(f'{g.variable.get()} deg')) # Setup some indicator controls ttk.Scale(root, from_=0, to=360, variable=gauge.variable).pack(fill='x', padx=10, pady=10) ttk.Button(root, text='Increment the Indicator', command=gauge.step).pack(padx=10, pady=10, fill='x') root.mainloop()
def __init__(self): super().__init__() self.title('Long Running Operation - Indeterminate') self.style = Style('lumen') # set the main background color to primary, then add 10px padding to create a thick border effect self.configure(background=self.style.colors.primary) self.lr = LongRunning(self) self.lr.pack(fill='both', expand='yes', padx=10, pady=10)
def __init__(self): super().__init__() self.title('Magic Mouse') self.style = Style('lumen') self.window = ttk.Frame(self) self.window.pack(fill='both', expand='yes') self.nb = ttk.Notebook(self.window) self.nb.pack(fill='both', expand='yes', padx=5, pady=5) mu = MouseUtilities(self.nb) self.nb.add(mu, text='Mouse 1') # add demo tabs self.nb.add(ttk.Frame(self.nb), text='Mouse 2') self.nb.add(ttk.Frame(self.nb), text='Mouse 3')
def __init__(self): super().__init__() self.title('Accordion Widget') self.style = Style('flatly') # accordian widget 1 accordian1 = AccordionWidget(self, header_text='Option Group 1', style='primary.TFrame') accordian1.pack(fill='x') contents1 = ttk.Frame(accordian1) for x in range(5): b = ttk.Checkbutton(contents1, text=f'Option {x + 1}') b.pack(side='top', fill='x') b.invoke() # accordian widget 2 accordian2 = AccordionWidget(self, header_text='Option Group 2', style='danger.TFrame') accordian2.pack(fill='x') contents2 = ttk.Frame(accordian2) for x in range(5): b = ttk.Checkbutton(contents2, text=f'Option {x + 1}') b.pack(side='top', fill='x') b.invoke() entry = ttk.Entry(contents2, style='danger.TEntry') entry.pack(fill='x', pady=(10, 5)) entry.insert('end', 'sample text') ttk.Button(contents2, text='Submit', style='danger.TButton').pack(fill='x', pady=5) # accordian widget 3 accordian3 = AccordionWidget(self, header_text='Option Group 3', style='success.TFrame') accordian3.pack(fill='x') contents3 = ttk.Frame(accordian3) for x in range(5): b = ttk.Checkbutton(contents3, text=f'Option {x + 1}') b.pack(side='top', fill='x') b.invoke() accordian1.add(contents1) accordian1.header_btn.invoke() # collapse accordian 1 accordian2.add(contents2) accordian3.add(contents3)
def obtainPrivateKey(self): try: # Main Window style = Style(theme="flatly") self.root = style.master self.root.geometry('400x110') self.root.resizable(width=True,height=True) self.root.title('Authentication') logo = PhotoImage(file = L_PATH) self.root.iconphoto(False, logo) # = = = = = = Widget Functionality = = = = = = = = privateKey = StringVar() self.labelPrivKey = ttk.Label(self.root, text="Private Key:") self.valuePrivKey = ttk.Entry(self.root, textvariable=privateKey, width=30) self.separ1 = ttk.Separator(self.root, orient=HORIZONTAL) self.bOK = ttk.Button(self.root, text="Use this Private Key", style="success.TButton", command=partial(self.validate, self.valuePrivKey)) self.bCancel = ttk.Button(self.root, text="Cancel", style="secondary.TButton", command=self.root.destroy) self.labelPrivKey.pack(side=TOP, fill=BOTH, expand=True, padx=5, pady=2) self.valuePrivKey.pack(side=TOP, fill=X, expand=True, padx=5, pady=2) self.separ1.pack(side=TOP, fill=BOTH, expand=True, padx=5, pady=5) self.bOK.pack(side=LEFT, fill=BOTH, expand=True, padx=2, pady=5) self.bCancel.pack(side=LEFT, fill=BOTH, expand=True, padx=2, pady=5) self.root.mainloop() # self.root.iconbitmap('App/Icons/App_Logo.ico') resul = hex(int("0x"+privateKey.get(), 16)) except ValueError as e: pass except Exception as e: self.errorNotif.showUnexpErrorNotif(e, "obtainPrivateKey") return resul
def __init__(self, app) -> None: super().__init__("Antimonium") self.app = app style = Style("darkly") self.title("Antimonium") self.resizable(False, False) self.menu = tk.Menu(self) self.list_menu = tk.Menu(self.menu, tearoff=0) self.list_menu.add_command(label="Import list...", underline=0) self.list_menu.add_command(label="Export list...", underline=0) self.process_menu = tk.Menu(self.menu, tearoff=0) self.process_menu.add_command(label="Stop all", underline=0) self.help_menu = tk.Menu(self.menu, tearoff=0) self.help_menu.add_command(label="About", command=self.about, underline=0) self.help_menu.add_command(label="License", command=self.license, underline=0) self.menu.add_cascade(label="File", menu=self.list_menu, underline=0) self.menu.add_cascade(label="Process", menu=self.process_menu, underline=0) self.menu.add_cascade(label="Help", menu=self.help_menu, underline=0) self.config(menu=self.menu) self.left_frame = LeftFrame(self) self.frame_separator = Separator(self, orient="vertical") self.right_frame = RightFrame(self) self.left_frame.grid(row=0, column=0, padx=3, pady=3, sticky="ns") self.frame_separator.grid(row=0, column=1, padx=3, pady=3, sticky="ns") self.right_frame.grid(row=0, column=2, padx=3, pady=3, sticky="ns")
self.root.deiconify() # make the window visible. self.root.attributes('-topmost', True) def weekday_header(self): """Returns a list of weekdays to be used as a header in the calendar based on the firstweekday""" weekdays = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'] return weekdays[self.firstweekday:] + weekdays[:self.firstweekday] if __name__ == '__main__': # TODO setup the styling in the __init__ file, and setup the class so that it can be easilily modified. # TODO add documentation to all classes and methods. # TODO reduce the padding on the DateEntry button for dark themes to account for the removed border on dark # theme entry widgets. style = Style('lumen') pressed_vd = -0.2 disabled_bg = (Colors.update_hsv(style.colors.inputbg, vd=-0.2) if style.theme.type == 'light' else Colors.update_hsv(style.colors.inputbg, vd=-0.3)) style.configure('calendar.primary.Outline.Toolbutton', lightcolor=style.colors.bg, darkcolor=style.colors.bg, bordercolor=style.colors.bg) style.configure('exit.primary.TButton', relief='flat', font='helvetica 12') style.configure('chevron.primary.TButton', font='helvetica 14') style.map('exit.primary.TButton', background=[ ('disabled', disabled_bg), ('pressed', '!disabled', Colors.update_hsv(style.colors.primary, vd=pressed_vd)),
delta (int): the amount to change the indicator. """ if self.amountused >= self.amounttotal: self.towardsmaximum = True self.amountused = self.amountused - delta elif self.amountused <= 0: self.towardsmaximum = False self.amountused = self.amountused + delta elif self.towardsmaximum: self.amountused = self.amountused - delta else: self.amountused = self.amountused + delta if __name__ == '__main__': style = Style() root = style.master root.title('ttkbootstrap') Meter(root, metersize=180, padding=20, amountused=25, metertype='semi', labeltext='miles per hour', interactive=True).grid(row=0, column=0) Meter(metersize=180, padding=20, amountused=1800, amounttotal=2600, labeltext='storage used',
def __init__(self): super().__init__() self.title('Text Reader') self.style = Style() self.reader = Reader(self) self.reader.pack(fill='both', expand='yes')
class CreatorBaseChooser(tk.Tk): def __init__(self): super().__init__() self.style = Style() self.title('TTK Creator') self.geometry(f'819x543') self.frame = ttk.Frame(self) self.setup() # self.eval('tk::PlaceWindow . center') self.bind("<Insert>", self.get_bounding_box) def setup(self): self.frame.pack(fill='both', expand='yes') lbl = ttk.Label(self.frame, text='What kind of theme do you want to create?', font='-size 16 -slant italic') lbl.pack(side='top', pady=(35, 40)) self.style.configure('light.Outline.TButton', font='-size 20') self.style.configure('dark.TButton', font='-size 20') light = ttk.Button(self.frame, text='Light', style='light.Outline.TButton', command=self.create_light_theme) light.pack(side='left', expand='yes', fill='both') dark = ttk.Button(self.frame, text='Dark', style='dark.TButton', command=self.create_dark_theme) dark.pack(side='right', expand='yes', fill='both') def create_dark_theme(self): """ Startup the design window with the 'flatly' theme """ valid_user_path = self.check_user_themes_path() if not valid_user_path: return self.style.theme_use(themename='darkly') CreatorDesignWindow(self) self.withdraw() def create_light_theme(self): """ Startup the design window with the 'superhero' theme """ valid_user_path = self.check_user_themes_path() if not valid_user_path: return CreatorDesignWindow(self) self.withdraw() def save_screenshot(self, bbox): # screenshot img = ImageGrab.grab(bbox=bbox) # image name filename = '../../docs/images/ttkcreator-splash.png' print(filename) img.save(filename, 'png') def get_bounding_box(self, event): """ Take a screenshot of the current demo window and save to images """ # bounding box titlebar = 31 x1 = self.winfo_rootx() - 1 y1 = self.winfo_rooty() - titlebar x2 = x1 + self.winfo_width() + 2 y2 = y1 + self.winfo_height() + titlebar + 1 self.save_screenshot([x1, y1, x2, y2]) def check_user_themes_path(self): """ If the user defined themes path does not exists, ask for one :returns: is there a valid path for themes or not? :rtype: bool """ json_string = importlib.resources.read_text('ttkbootstrap', 'themes.json') settings = json.loads(json_string) if settings['userpath'] and Path(settings['userpath']).exists(): return True showwarning(title="User Defined Themes", message='Please supply a path to save user-defined themes') userpath = asksaveasfilename( parent=self, title='User Defined Themes', defaultextension='json', initialfile='ttkbootstrap_themes.json', confirmoverwrite=False, ) if not userpath: showwarning( title='User Defined Themes', message='Cannot save user-defined themes without a valid path') return False else: # set the new userpath settings['userpath'] = userpath with importlib.resources.path('ttkbootstrap', 'themes.json') as path: with open(path, 'w', encoding='utf-8') as f: json.dump(settings, f, indent='\t') # create the new file if not exists if not Path(userpath).exists(): template = {"themes": []} with open(userpath, 'w', encoding='utf-8') as f: json.dump(template, f, indent='\t') return True
from tkinter import Tk, ttk, Text, Button from googletrans import Translator from ttkthemes import ThemedTk from ttkbootstrap import Style translator = Translator() # Janela Tk default # janela = Tk() # Janela do ttkthemes # janela = ThemedTk(theme='breeze') # Janela do ttkbootstrap style = Style(theme='darkly') janela = style.master janela.title('Duno Translator!') frame_geral = ttk.Frame() def traduzir(evento=None): texto = entrada.get('1.0', 'end') src = combo_entrada.get() dest = combo_saida.get() resultado = translator.translate(text=texto, src=src, dest=dest) saida.configure(state='normal') saida.delete('1.0', 'end')
import tkinter as tk from ttkbootstrap import Style from random import choice root = tk.Tk() root.minsize(500, 500) style = Style('superhero') def new_theme(): theme = choice(style.theme_names()) print(theme) style.theme_use(theme) btn = tk.Button(root, text='Primary') btn.configure(command=new_theme) btn.pack(padx=10, pady=10, fill=tk.BOTH, expand=tk.YES) label = tk.Label(text="Hello world!") label.pack(padx=10, pady=10) text = tk.Text() text.pack(padx=10, pady=10) text.insert(tk.END, 'This is a demo of themes applied to regular tk widgets.') frame = tk.Frame() frame.pack(padx=10, pady=10, fill=tk.X) cb1 = tk.Checkbutton(frame, text="Check 1") cb1.pack(padx=10, pady=10, side=tk.LEFT)
@value.setter def value(self, value): self.variable.set(value) def _textvariable_write(self, *args): """Callback to update the label text when there is a `write` action on the textvariable Args: *args: if triggered by a trace, will be `variable`, `index`, `mode`. """ self.tk.call("ttk::style", "configure", self._widgetstyle, '-%s' % 'text', self.textvariable.get(), None) if __name__ == '__main__': # TESTING root = tk.Tk() root.title('ttkbootstrap') s = Style() p = Floodgauge(orient='vertical', style='danger.Vertical.TFloodgauge') def auto(progress): p.text = f'Memory\n{p.value}%' p.step(1) p.after(50, auto, p) p.pack(fill='both', expand='yes') auto(p) root.mainloop()
def __init__(self): super().__init__() self.title('Timer') self.style = Style() self.timer = TimerWidget(self) self.timer.pack(fill='both', expand='yes')
""" Author: Israel Dryer Modified: 2021-05-04 """ from ttkbootstrap import Style from ttkbootstrap.widgets import Meter style = Style('cosmo') root = style.master root.title('ttkbootstrap') m1 = Meter(metersize=180, padding=20, amountused=25, metertype='semi', labeltext='miles per hour', interactive=True) m1.grid(row=0, column=0) m2 = Meter(metersize=180, padding=20, amountused=1800, amounttotal=2600, labeltext='storage used', textappend='gb', meterstyle='info.TLabel', stripethickness=10, interactive=True) m2.grid(row=0, column=1)
import socket import sys import requests import re from tkinter import * import tkinter.ttk as ttk from ttkbootstrap import Style import requests import os if not os.path.exists('recent.dat'): open('recent.dat', 'w') style = Style(theme="sandstone") win = style.master win.title('SMIRC') win.protocol("WM_DELETE_WINDOW", lambda: sys.exit(9487)) my_ip, port, password = '', None, '' ip = requests.get('http://ip.42.pl/raw').text def connect(): global my_ip, port, password my_ip, port, password = my_ip_entry.get(), int( port_entry.get()), password_entry.get().strip() if my_ip not in open('recent.dat', 'r').read(): open('recent.dat', 'a').write(my_ip + '\n') win.destroy() container = Frame(win)
} agregar=pd.DataFrame(agregar) citas_csv=citas_csv.append(agregar,ignore_index=True) citas_csv=citas_csv.drop_duplicates(subset="codigo",ignore_index=True) citas_csv.to_csv("./datos/Citas.csv") def informacionCitas(): return ventana_principal=Tk() ventana_principal.title(str(clinica_objeto.getNombre())) ventana_principal.resizable(0,0) lista_entry_datos_paciente=[] s=Style() s.theme_use("darkly") posicion_img=[] #boton para guardar fecha y hora reservar_hora_ic = PIL.Image.open('./imagenes/reservarhora.png') reservar_hora_ic = reservar_hora_ic.resize((50, 50), PIL.Image.ANTIALIAS) reservar_hora_ic = PIL.ImageTk.PhotoImage(reservar_hora_ic) #FUENTES titulo_font = font.Font(family="Arial",weight="bold",size=35) subtitulo_font = font.Font(family="Arial Nova", weight="bold",size= 20) subtitulo2_font = font.Font(family="Arial Narrow", weight="bold",size=15) subtitulo3_font = font.Font (family= "Arial Narrow", size= 15) subtitulo4_font = font.Font (family= "Arial Narrow", size= 15)
# check into this project for more info on implementation: https://pypi.org/project/tkcalendar/ import tkinter as tk from tkinter import ttk from ttkbootstrap import Style import calendar c = calendar.Calendar() c.setfirstweekday(calendar.SUNDAY) md = c.monthdayscalendar(2021, 4) print(md) root = tk.Tk() style = Style() style.theme_use('flatly') root.columnconfigure(1, weight=1) ttk.Button(root, text='<').grid(row=0, column=0, sticky='nsw') ttk.Label(root, text='April 2021', anchor='center', style='primary.Inverse.TLabel').grid(row=0, column=1, sticky='nswe') ttk.Button(root, text='>').grid(row=0, column=2, sticky='nse') day_grid = ttk.Frame() for i in range(7): day_grid.columnconfigure(i, weight=1) for j in range(len(md)): day_grid.rowconfigure(j, weight=1)
def __init__(self, textImage, dogsOrCats): self.errorNotif = ErrorNotification() # Main Window style = Style(theme="flatly") self.root = style.master self.root.geometry('570x590') self.root.resizable(width=True, height=True) self.root.title('Admin') logo = PhotoImage(file=L_PATH) self.root.iconphoto(False, logo) # = = = = = = Widget Functionality = = = = = = = = # Information Field self.tinfo = Text(self.root, width=75, height=20) # Image Text Contest Buttons self.textFrame = ttk.LabelFrame(self.root, text=' Text from Image ') self.innerFrame1_text = ttk.Frame(self.textFrame) self.binfo_text = ttk.Button(self.innerFrame1_text, text='Info', style="info.Outline.TButton", command=partial(self.info, textImage)) self.bSetContest_text = ttk.Button(self.innerFrame1_text, text='Set Contest', command=partial( self.setContest, textImage)) self.bResetContest_text = ttk.Button(self.innerFrame1_text, text='Reset Contest', style="primary.TButton", command=textImage.resetContest) self.bCalculateWinners_text = ttk.Button( self.innerFrame1_text, text='Calculate Winner/s', command=textImage.calculateWinners) self.bSendPrize_text = ttk.Button(self.innerFrame1_text, text='Send Prize', style="primary.TButton", command=textImage.sendPrizeToWinners) self.innerFrame2_text = ttk.Frame(self.textFrame) self.bExpelWinner_text = ttk.Button( self.innerFrame2_text, text='Expel Winner', style="warning.TButton", command=textImage.sendPrizeToWinners) self.bSetAdmin_text = ttk.Button(self.innerFrame2_text, text='Set New Admin', style="danger.TButton", command=partial( self.setAdmin, textImage)) # Dog Or Cat Contest Buttons self.DoCFrame = ttk.LabelFrame(self.root, text=' Dog or Cat ') self.innerFrame1_DoC = ttk.Frame(self.DoCFrame) self.binfo_DoC = ttk.Button(self.innerFrame1_DoC, text='Info', style="info.Outline.TButton", command=partial(self.info, dogsOrCats)) self.bSetContest_DoC = ttk.Button(self.innerFrame1_DoC, text='Set Contest', command=partial( self.setContest, dogsOrCats)) self.bResetContest_DoC = ttk.Button(self.innerFrame1_DoC, text='Reset Contest', command=dogsOrCats.resetContest) self.bCalculateWinners_DoC = ttk.Button( self.innerFrame1_DoC, text='Calculate Winner/s', command=dogsOrCats.calculateWinners) self.bSendPrize_DoC = ttk.Button(self.innerFrame1_DoC, text='Send Prize', command=dogsOrCats.sendPrizeToWinners) self.innerFrame2_DoC = ttk.Frame(self.DoCFrame) self.separator3 = ttk.Separator(self.root, orient=HORIZONTAL) self.bExpelWinner_DoC = ttk.Button( self.innerFrame2_DoC, text='Expel Winner', style="warning.TButton", command=dogsOrCats.sendPrizeToWinners) self.bSetAdmin_DoC = ttk.Button(self.innerFrame2_DoC, text='Set New Admin', style="danger.TButton", command=partial( self.setAdmin, dogsOrCats)) # Exit Button self.bExit = ttk.Button(self.root, text='Exit', style="secondary.TButton", command=self.root.destroy) # = = = = = = Widget Placement = = = = = = = = # Information Field self.tinfo.pack(side=TOP, pady=4) # Image Text Contest Buttons self.textFrame.pack(side=TOP, fill=BOTH, expand=True, padx=5, pady=8) self.innerFrame1_text.pack(side=TOP, fill=BOTH, expand=True, padx=0, pady=1) self.binfo_text.pack(side=LEFT, fill=BOTH, expand=True, padx=1, pady=0) self.bSetContest_text.pack(side=LEFT, fill=BOTH, expand=True, padx=1, pady=0) self.bResetContest_text.pack(side=LEFT, fill=BOTH, expand=True, padx=1, pady=0) self.bCalculateWinners_text.pack(side=LEFT, fill=BOTH, expand=True, padx=1, pady=0) self.bSendPrize_text.pack(side=LEFT, fill=BOTH, expand=True, padx=1, pady=0) self.innerFrame2_text.pack(side=BOTTOM, fill=BOTH, expand=True, padx=0, pady=1) self.bExpelWinner_text.pack(side=LEFT, fill=BOTH, expand=True, padx=1, pady=0) self.bSetAdmin_text.pack(side=LEFT, fill=BOTH, expand=True, padx=1, pady=0) # Dog Or Cat Contest Buttons self.DoCFrame.pack(side=TOP, fill=BOTH, expand=True, padx=5, pady=8) self.innerFrame1_DoC.pack(side=TOP, fill=BOTH, expand=True, padx=0, pady=1) self.binfo_DoC.pack(side=LEFT, fill=BOTH, expand=True, padx=1, pady=0) self.bSetContest_DoC.pack(side=LEFT, fill=BOTH, expand=True, padx=1, pady=0) self.bResetContest_DoC.pack(side=LEFT, fill=BOTH, expand=True, padx=1, pady=0) self.bCalculateWinners_DoC.pack(side=LEFT, fill=BOTH, expand=True, padx=1, pady=0) self.bSendPrize_DoC.pack(side=LEFT, fill=BOTH, expand=True, padx=1, pady=0) self.innerFrame2_DoC.pack(side=BOTTOM, fill=BOTH, expand=True, padx=1, pady=1) self.bExpelWinner_DoC.pack(side=LEFT, fill=BOTH, expand=True, padx=1, pady=0) self.bSetAdmin_DoC.pack(side=LEFT, fill=BOTH, expand=True, padx=1, pady=0) self.separator3.pack(side=TOP, fill=BOTH, expand=True, padx=2, pady=1) # Exit Button self.bExit.pack(side=TOP, fill=BOTH, expand=True, padx=2, pady=2) # = = = = = = = = = = = = = = self.binfo_text.focus_set() self.root.mainloop()
df = pd.read_excel(file_path, sheet_name=None) for i in df.keys(): date = pd.read_excel(file_path, sheet_name=i) date.to_excel(i + '.xlsx', index=False) return () """ GUI界面设置 """ # 告诉操作系统使用程序自身的dpi适配 ctypes.windll.shcore.SetProcessDpiAwareness(1) # 获取屏幕的缩放因子 ScaleFactor = ctypes.windll.shcore.GetScaleFactorForDevice(0) style = Style(theme="litera", ) top = style.master # top.geometry("600x200") top.title("流调拆分小工具") top.rowconfigure(0, weight=1) top.columnconfigure(1, weight=1) top.tk.call("tk", "scaling", ScaleFactor / 75) # 设置程序缩放 file_path = StringVar() def open(): filename = file.askopenfilename() file_path.set(filename)
def __init__(self): super().__init__() self.title('Simple data entry form') self.style = Style() self.form = EntryForm(self) self.form.pack(fill='both', expand='yes')
print( "Could not save to file: did you delete the USER_BUTTONS.ini file?" ) # ______________________________________ #| Creation of GUI windows and elements | # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # Root Window. Contains the Left Window and the Right Window root = tk.Tk() root.protocol("WM_DELETE_WINDOW", quit) root.title("Discomata") root.configure() deleteMessage = tk.IntVar() discordStyle = Style(theme='discord', themes_file='discordTheme.json') botUsername = tk.StringVar() botUsername.set("Loading...") # _____________________________________________________ # | Frame Creation | For defining the layout of the GUI | # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ botInfoFrame = ttk.Frame(root, width=335, height=150, relief="raised") addCommandsFrame = ttk.LabelFrame(root, height=200, width=400, text=" Add Command ") settingsFrame = ttk.LabelFrame(botInfoFrame, text=" Settings ") useCommandsFrame = ttk.LabelFrame(root, text=" Buttons ") consoleNotebook = ttk.Notebook(root, style="primary.TNotebook")