def set_valores_hist(x): try: valor = Back.historicos(Back.request(keys_api[filtro.get()])) lbl_hist_fecha_max.configure(text=valor[1]["d"]) lbl_hist_valor_max.configure(text=round(valor[1]["v"])) lbl_hist_fecha_min.configure(text=valor[0]["d"]) lbl_hist_valor_min.configure(text=round(valor[0]["v"])) except KeyError: tkinter.messagebox.showinfo('Error','Seleccione un campo')
def set_valores(): try: valores = Back.busqueda_ultimo(Back.request(keys_api[filtro.get()])) lbl_ultimo_valor.configure(text=round(valores['ultimo']['v'])) lbl_ultimo_par.configure(text="{0}:{1}".format(valores['ultimo']["d"], round(valores['ultimo']["v"]))) lbl_var_diaria_valor.configure(text=str(valores['var_diario'][2])) lbl_var_diaria_par.configure(text="{0}:{1}".format(valores['var_diario'][1],round(valores['var_diario'][0]))) lbl_var_mensual_valor.configure(text=str(valores['var_mensual'][2])) lbl_var_mensual_par.configure(text="{0}:{1}".format(valores['var_mensual'][1],round(valores['var_mensual'][0]))) lbl_var_anual_valor.configure(text=str(valores['var_anual'][2])) lbl_var_anual_par.configure(text="{0}:{1}".format(valores['var_anual'][1],round(valores['var_anual'][0]))) except KeyError: tkinter.messagebox.showinfo('Error','Seleccione un campo')
def displayLabel(self): ''' Displays comparison results Runs comparison algorithm and displays a label with the results Parameters ---------- None Returns ------- String Raises ------ None ''' if imageOneSelected == True and imageTwoSelected == True: fileName = usersName + "_image_directory.txt" text1 = tk.Label(self, text=str( bk.comparator(usersName, file1, file2, 4, directory1, directory2, save1, saveName1, save2, saveName2, fileName))) text1.place(x=1, y=175) else: popupAlert("Select both images")
def crear_grafico(rango): try: lista_valores = Back.lista_por_rango(Back.request(keys_api[filtro.get()]), rango) x_labels = [val[0] for val in lista_valores] y_labels = [val[1] for val in lista_valores] plt.figure(figsize=(12, 6)) ax = pd.Series(y_labels).plot(kind='bar') ax.set_xticklabels(x_labels) rects = ax.patches for rect, label in zip(rects, y_labels): height = rect.get_height() ax.text(rect.get_x() + rect.get_width()/2, height + 5, label, ha='center', va='bottom') except KeyError: tkinter.messagebox.showinfo('Error','Seleccione un campo')
%matplotlib qt from tkinter import * import Back, tkinter.ttk as ttk, matplotlib.pyplot as plt, pandas as pd, tkinter.messagebox from PIL import Image, ImageTk #Creacion Tk root = Tk() root.geometry('1000x680') root.title('My BCRA stats App') root.configure(bg='darkcyan') root.resizable(0,0) #globales keys_api = Back.dic_keys_auxiliares() #Funciones def crear_grafico(rango): try: lista_valores = Back.lista_por_rango(Back.request(keys_api[filtro.get()]), rango) x_labels = [val[0] for val in lista_valores] y_labels = [val[1] for val in lista_valores] plt.figure(figsize=(12, 6)) ax = pd.Series(y_labels).plot(kind='bar') ax.set_xticklabels(x_labels) rects = ax.patches for rect, label in zip(rects, y_labels): height = rect.get_height() ax.text(rect.get_x() + rect.get_width()/2, height + 5, label, ha='center', va='bottom') except KeyError:
import pygame import telas as t import uteis as u import cat as c import Back as b import mouse as m import cloud as cl import game as g todas_as_sprites = pygame.sprite.Group() cat = c.Cat() back = b.Back() todas_as_sprites.add(back) todas_as_sprites.add(cat) for i in range(3): cloud = cl.Cloud() todas_as_sprites.add(cloud) mouse1 = m.Mouse() mouse2 = m.Mouse() mouse3 = m.Mouse() mouse4 = m.Mouse() todas_as_sprites.add(mouse1, mouse2, mouse3, mouse4) grupo_obstaculos = pygame.sprite.Group() grupo_obstaculos.add(mouse1, mouse2, mouse3, mouse4) grupo_oM1 = pygame.sprite.Group() grupo_oM1.add(mouse2, mouse3, mouse4)
def __init__(self, root): Frame.__init__(self, root) self.root = root self.root.geometry('960x600') self.root.title('Yagan - Higher lower game') self.root.iconbitmap(r'C:\Users\User\Desktop\Python\Lower_Higher\BLACKJACKICON.ico') self.mainframe = Frame(self.root, bg='Green') self.mainframe.pack(fill=BOTH, expand=True) self.deck = Game_Cards() #self.restart_button = Button(self.root, bg="red", width=12, height=1, text="Restart game", font = "Calibri 24", command= Back.restart_program) #self.restart_button.place(relx=.8, rely=.6, anchor="c") #Button to show the back of a card on top of the screen self.hiddenimg = self.deck.hiddenCard_img self.top_deck_button = Button(self.mainframe, image=self.hiddenimg, bg="Green") self.top_deck_button.place(x=400,y=50) #sec ==> getting the first card in the deck for a player and getting its value self.sec = self.deck.ccdeck.pop() self.deck.cardvalue[0] = (self.sec)[1] self.cardimg2 = (self.sec)[0] #Player card button self.player_card_button = Button(self.mainframe, image=self.cardimg2, bg="Green") self.player_card_button.place(x=400,y=300) #Tutrial button self.how_to_play_button = Button(self.root, bg="red", width=12, height=1, text="How to play", font = "Calibri 24", command= Back.rules) self.how_to_play_button.place(relx=.8, rely=.8, anchor="c") #Title button self.titlebutton = Button(self.root, bg="green", width=12, height=1, text="Your card is: ", font = "Calibri 36") self.titlebutton.place(relx=.2, rely=.2, anchor="c") #higher button self.higherbutton = Button(self.root, bg="red",width=12, height=1, text="Higher", font = "Calibri 36", command= lambda: Back.higher(self.deck.ccdeck,self.player_card_button,self.streakbutton,self.deck.streak,self.deck.cardvalue,self.root)) self.higherbutton.place(relx=.2, rely=.4, anchor="c") #lower button self.lowerbutton = Button(self.root, bg="red",width=12, height=1, text="Lower", font = "Calibri 36", command= lambda: Back.lower(self.deck.ccdeck,self.player_card_button,self.streakbutton,self.deck.streak,self.deck.cardvalue,self.root)) self.lowerbutton.place(relx=.2, rely=.6, anchor="c") #streak button self.streakbutton = Button(self.root, bg="green",width=12, height=1, text=(f"Your streak is:\n{self.deck.streak[0]}"), font = "Calibri 36") self.streakbutton.place(relx=.8, rely=.2, anchor="c")
from tkinter import * import Back data = Back.Database() print(data.select()) def add_entry(): list.delete(1, END) data.insert(title.get(), author.get(), year.get(), isbn.get()) list.insert(END, (title.get(), author.get(), year.get(), isbn.get())) def clear_all_entries(): title_entry.delete(0, END) author_entry.delete(0, END) year_entry.delete(0, END) isbn_entry.delete(0, END) def search_entry(): list.delete(0, END) for row in data.search(title.get(), author.get(), year.get(), isbn.get()): list.insert(END, row) def view_all(): list.delete(0, END) for row in data.select(): list.insert(END, row)
def Update(): Back.Update(selected_tuple[0], ent1.get(), ent2.get(), ent3.get(), ent4.get()) print(selected_tuple[0], selected_tuple[1], selected_tuple[2], selected_tuple[3], selected_tuple[4])
def Delete(): Back.Delete(selected_tuple[0])
def Insert(): Back.Insert(ent1.get(), ent2.get(), ent3.get(), ent4.get()) list1.delete(0, END) list1.insert(END, "ModelName:- " + ent1.get(), "Company:- " + ent2.get(), "Year:- " + ent3.get(), "ChasisNo:- " + ent4.get())
def Search(): list1.delete(0, END) for row in Back.Search(ent1.get(), ent2.get(), ent3.get(), ent4.get()): list1.insert(END, row)
def ViewAll(): list1.delete(0, END) for row in Back.View(): list1.insert(END, row)