class Application(tkinter.Tk): 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)
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) subtitulo5_font = font.Font (family= "Arial Narrow", size= 12)
# 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)
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