def Creditos(): Ventana1 = Tk() Ventana1.title("Créditos") Ventana1.geometry("500x200") Ventana1.resizable(width=False, height=False) im = Image.open("Info/proteco.png") im = im.resize((100, 100), Image.ANTIALIAS) ph = ImageTk.PhotoImage(im, master=Ventana1) label = Label(Ventana1, image=ph).place(x=20, y=20) MARIO = Label(Ventana1, text="Mario Alberto Vásquez Cancino ").place(x=140, y=35) MARIO1 = Label(Ventana1, text="Becario PROTECO Generación 37").place(x=160, y=55) MARIO2 = Label(Ventana1, text="Unánse al programa está super padre :)").place(x=140, y=75) PROTECO = Label(Ventana1, text="Info en Facebook: Proteco").place(x=160, y=95) RAUL = Label( Ventana1, text="Agradecimientos especiales a Raul E. Lopez Briega:").place(x=20, y=140) RAUL1 = Label( Ventana1, text="-Por tan buen blog, base para poder realizar este programa." ).place(x=40, y=160) Ventana1.mainloop()
def InfoNor(): Ventana1 = Tk() Ventana1.title("Distribución Normal") Ventana1.geometry("965x290") Ventana1.resizable(width=False, height=False) im = Image.open("Info/nor.png") ph = ImageTk.PhotoImage(im, master=Ventana1) label = Label(Ventana1, image=ph).place(x=0, y=0) Ventana1.mainloop()
def InfoHiper(): Ventana1 = Tk() Ventana1.title("Distribución Hipergeométrica") Ventana1.geometry("985x535") Ventana1.resizable(width=False, height=False) im = Image.open("Info/hiper.png") ph = ImageTk.PhotoImage(im, master=Ventana1) label = Label(Ventana1, image=ph).place(x=0, y=0) Ventana1.mainloop()
def InfoPoi(): Ventana1 = Tk() Ventana1.title("Distribución Poisson") Ventana1.geometry("980x400") Ventana1.resizable(width=False, height=False) im = Image.open("Info/poi.png") ph = ImageTk.PhotoImage(im, master=Ventana1) label = Label(Ventana1, image=ph).place(x=0, y=0) Ventana1.mainloop()
def InfoExp(): Ventana1 = Tk() Ventana1.title("Distribución Exponencial") Ventana1.geometry("960x284") Ventana1.resizable(width=False, height=False) im = Image.open("Info/exp.png") ph = ImageTk.PhotoImage(im, master=Ventana1) label = Label(Ventana1, image=ph).place(x=0, y=0) Exponencial() Ventana1.mainloop()
def InfoUni(): Ventana1 = Tk() Ventana1.title("Distribución Uniforme") Ventana1.geometry("730x445") Ventana1.resizable(width=False, height=False) im = Image.open("Info/uni.png") ph = ImageTk.PhotoImage(im, master=Ventana1) label = Label(Ventana1, image=ph).place(x=0, y=0) Uniforme() Ventana1.mainloop()
def InfoBer(): Ventana1 = Tk() Ventana1.title("Distribución Bernoulli") Ventana1.geometry("964x345") Ventana1.resizable(width=False, height=False) im = Image.open("Info/ber.png") ph = ImageTk.PhotoImage(im, master=Ventana1) label = Label(Ventana1, image=ph).place(x=0, y=0) Bernoulli() Ventana1.mainloop()
class MainApp: def __init__(self): self.pre = None #model to predict self.model = Model() #creating root self.root = Tk() self.root.title("Digit Recognizer") self.root.resizable(0,0) #Gui elements self.lbl_drawhere = LabelFrame(text = 'Draw Here With Mouse') self.area_draw = Canvas(self.lbl_drawhere, width = 504, height = 504, bg ='black') self.area_draw.bind('<B1-Motion>',self.draw) self.btn_reset = Button(self.lbl_drawhere, text = "Reset Drawing", bg = "lightblue",command = self.reset_drawing) self.btn_predict = Button(self.root, text = 'Predict Digit', bg = "blue", command = self.predict_digit) #Fitting in th Gui self.lbl_drawhere.pack(in_=self.root, side = LEFT, fill = X) self.area_draw.pack() self.btn_reset.pack() self.btn_predict.pack(in_=self.root, side = LEFT) def draw(self,event): self.area_draw.create_oval(event.x,event.y,event.x+27,event.y+27, outline='white',fill = 'white') self.area_draw.create_rectangle(event.x,event.y,event.x+25,event.y+25, outline = 'white',fill = 'white') self.pre = 'D' def run(self): self.root.mainloop() def reset_drawing(self): self.area_draw.delete('all') def predict_digit(self): if(self.pre == None): messagebox.showerror(title = 'No Images', messgae = 'First Draw a number') else: x = self.root.winfo_rootx() + self.area_draw.winfo_x() y = self.root.winfo_rooty() + self.area_draw.winfo_y() x1 = x + self.area_draw.winfo_width() y1 = y + self.area_draw.winfo_height() ImageGrab.grab(bbox = (x,y+10,x1,y1)).save('image.png') messagebox.showinfo( title = 'Prediction' , message = "Number: {}".format(self.model.predict()))
def mainloop(file): global window global entry global txt global author global send_to send_to = None author = file sock = socket.socket() sock.connect(('25.95.4.168', 10001)) sock.send((file + ' connect').encode('utf-8')) data = sock.recv(1024).decode('utf-8') sock.close() window = Tk() window.resizable(False, False) window.title(file) window.geometry("800x800") while True: quit_btn = Button(window, text="Выйти", command=quit, bg="red") send_btn = Button(window, text="Отправить", command=send, bg="green") data = data.replace(file, "") accounts = data.split() frame = Frame(window) frame.place(x=200, y=0, width=600, height=600) txt = Text(frame, width=580, height=600, wrap=NONE, state=DISABLED) txt.pack(side="left") n = 0 for i in accounts: funk = partial(update, file, i) Button(window, command=funk, text=i).place(x=0, y=n * 120, width=200, height=120) n += 1 scroll = Scrollbar(frame, command=txt.yview, orient=VERTICAL, width=20) scroll.pack(side=RIGHT, fill=Y) txt.config(yscrollcommand=scroll.set) entry = Entry(window) quit_btn.place(x=200, y=695, width=100, height=50) send_btn.place(x=500, y=695, width=100, height=50) entry.place(x=200, y=600, width=600, height=40) window.mainloop() update(file, send_to)
def intermediaire3D(): root = Tk() root.config(bg="#DCDCDC") if var_langue == "francais": root.title("Options 3D") else: root.title("3D options") root.geometry("350x800") root.resizable( width=False, height=False) # Redimensionnement de la fenêtre immobilisée. police_options3D = font.Font( root, size=12, weight='bold', family='Helvectica') # Mise en place du style police. label1 = Label(root, text="Sélection les numéros de boutons à afficher :", font=police_options3D) label1.config(bg="#DCDCDC") label1.pack() f3 = Frame(root) s3 = Scrollbar(f3) l3 = Listbox(f3, selectmode=MULTIPLE, exportselection=0, bg='#F9F9F8', font=police_options3D) # EXTENDED f5 = Frame(root) l5 = Listbox(f5, selectmode=MULTIPLE, exportselection=0, bg='#F9F9F8', font=police_options3D) # EXTENDED if var_langue == "francais": l3.insert(0, 'Déselectionner') else: l3.insert(0, 'Deselect') l3.itemconfig(0, bg='#ff6666') if var_langue == "francais": for i in range(1, 40): l3.insert(i, 'Marqueur ' + str(i)) else: for i in range(1, 40): l3.insert(i, 'Marker ' + str(i)) s3.config(command=l3.yview) l3.config(yscrollcommand=s3.set) l3.pack(side=LEFT, fill=Y) s3.pack(side=RIGHT, fill=Y) f3.pack() def clic3(evt): items = l3.curselection() if 0 in items: l3.selection_clear(0, 40) global leger leger.extend(l3.curselection()) return print( items) # On retourne l'élément (un string) sélectionné def clicd3(evt): print(evt.y) # recupere la coordonée selon y print(l3.nearest(evt.y)) # reecupere le bouton le plus proche print(evt) fr = l3.nearest(evt.y) # vou[fr][i][0] # s1 = [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] s2 = [] s1 = [] t = [] fig = plt.figure() ax1 = fig.add_subplot(211) ax2 = fig.add_subplot(212, sharex=ax1) for i in range(len(vou[fr]) - 11550): s1.append(vou[fr][i][0]) s2.append((vou[fr][i + 1][0] - vou[fr][i][0]) / 15) t.append(i) print('att') ax1.plot(t, s1) # ax2.plot(t, s2) del s1[i] ax2.plot(t, s2) # t=np.arange(59) multi = MultiCursor(fig.canvas, (ax1, ax2), color='r', lw=1) pts = ginput(2) print(pts) x = math.floor(pts[0][0]) x1 = math.floor(pts[1][0]) y = str(s1[x]) v = str(s2[x]) y1 = str(s1[x1]) v1 = str(s2[x1]) ax1.text(0, 50, r'y(t)=' + y, fontsize=15, bbox={ 'facecolor': 'blue', 'alpha': 0.5, 'pad': 10 }) ax2.text(0, 13, r'v(y)=' + v, fontsize=15) ax1.annotate('y(t)=' + y, xy=(x, s1[x]), xytext=(x + 1, s1[x] + 5), arrowprops=dict(facecolor='black', shrink=0.05)) ax2.annotate('v(y)=' + v, xy=(x, s2[x]), xytext=(x + 1, s2[x] + 5), arrowprops=dict(facecolor='black', shrink=0.05)) ax1.text(0, 50, r'y(t)=' + y1, fontsize=15, bbox={ 'facecolor': 'blue', 'alpha': 0.5, 'pad': 10 }) ax2.text(0, 13, r'v(y)=' + v1, fontsize=15) ax1.annotate('y(t)=' + y1, xy=(x1, s1[x1]), xytext=(x1 + 1, s1[x1] + 5), arrowprops=dict(facecolor='black', shrink=0.05)) ax2.annotate('v(y)=' + v1, xy=(x1, s2[x1]), xytext=(x1 + 1, s2[x1] + 5), arrowprops=dict(facecolor='black', shrink=0.05)) plt.show() l3.bind( '<ButtonRelease-1>', clic3 ) ## on associe l'évènement "relachement du bouton gauche la souris" à la listbox l3.bind('<Double-Button-1>', clicd3) label2 = Label(root, text="Sélection du style :", font=police_options3D) label2.config(bg="#DCDCDC") label2.pack() f4 = Frame(root) s4 = Scrollbar(f4) l4 = Listbox(f4, selectmode=MULTIPLE, exportselection=0, bg='#F9F9F8', font=police_options3D) # EXTENDED if var_langue == "francais": l4.insert(0, 'Déselectionner') l4.itemconfig(0, bg='#ff6666') l4.insert(1, 'Traits') l4.insert(2, 'Points') l4.insert(3, 'Relier') l4.insert(4, 'Effacer') l4.insert(5, 'Historique') else: l4.insert(0, 'Deselect') l4.itemconfig(0, bg='#ff6666') l4.insert(1, 'Lines') l4.insert(2, 'Dots') l4.insert(3, 'Link') l4.insert(4, 'Erase') l4.insert(5, 'History') s4.config(command=l3.yview) l4.config(yscrollcommand=s4.set) l4.pack(side=LEFT, fill=Y) s4.pack(side=RIGHT, fill=Y) f4.pack() def clic4(evt): items = l4.curselection() if 0 in items: l4.selection_clear(0, 4) if 1 in items: l4.selection_clear(3) if 3 in items: l4.selection_clear(1) '''#animate(i)''' fonction3D(fenetreResultat, chemin, l4.curselection(), [], []) if (3 in items) == False: l4.selection_clear(4) if 4 in items: global lourd lourd = [] return print( items) ## On retourne l'élément (un string) sélectionné fonction3D(fenetreResultat, chemin, l4.curselection(), [], []) l4.bind( '<ButtonRelease-1>', clic4 ) ## on associe l'évènement "relachement du bouton gauche la souris" à la listbox label3 = Label(root, text="Points à afficher (tous par défaut):", font=police_options3D) label3.config(bg="#DCDCDC") label3.pack() s5 = Scrollbar(f5) if var_langue == "francais": l5.insert(0, 'Déselectionner') else: l5.insert(0, "Deselect") l5.itemconfig(0, bg='#ff6666') if var_langue == "francais": for i in range(1, 40): l5.insert(i, 'Marqueur ' + str(i)) else: for i in range(1, 40): l5.insert(i, 'Marker ' + str(i)) s5.config(command=l5.yview) l5.config(yscrollcommand=s5.set) l5.pack(side=LEFT, fill=Y) s5.pack(side=RIGHT, fill=Y) f5.pack() def clic5(evt): itemos = l5.curselection() if len(itemos) > 2: l5.selection_clear(itemos[0]) print(len(itemos)) if len(itemos) == 2: global lourd lourd.append(l5.curselection()) if 0 in itemos: l5.selection_clear(0, 40) return print( itemos) ## On retourne l'élément (un string) sélectionné l5.bind( '<ButtonRelease-1>', clic5 ) ## on associe l'évènement "relachement du bouton gauche la souris" à la listbox if var_langue == "anglais": label1["text"] = "Select the number of buttons to display :" label2["text"] = "Select the style :" label3["text"] = "Dots to display (all by default) :" root.mainloop()
#Procédure de fermeture de le fenêtre princiaple def Exit(): if askyesno("Exit", "Do you really want to exit kofi :'( ?"): showwarning('Exit', "Exiting...see you soon") main.destroy() else: showinfo('Exit', 'Welcome back on kofi!') #Initailisation de la fenêtre principale main = Tk() main.title("Kofi") main.configure(bg = "white") main.resizable(0,0) #main.attributes("-fullscreen", 2) #On récupère la largeur (ws) et la hauteur (hs) de la fenêtre ws = main.winfo_screenwidth() hs = main.winfo_screenheight() #calcul la position de la fenetre adaptée à l'écra, x = (ws/2) - (ws/2) y = (hs/2) - (hs/2) #applique la taille et la position main.geometry('%dx%d+%d+%d' % (ws, hs, 0, 0)) #intercepte l'evenement quit pour informer l'utilisateur, appel la fonction Exit main.protocol("WM_DELETE_WINDOW", Exit) # Fonction d'affichage de l'heure
def filechecking(): #grabs list of files from source path this way files = os.listdir(srcEntry.get()) for file in files: fullFilePath = srcEntry.get() + '/' + file # getting mtime of full file path and name time = os.path.getmtime(fullFilePath) modtime = datetime.datetime.fromtimestamp(time) if modtime > (datetime.datetime.now() - timedelta(hours = 24)): shutil.move(fullFilePath, destEntry.get()) # any modtime within 24 hours will be moved to dest folder root.title("File Check") root.geometry('500x400') root.resizable(False, False) lbl = Label(root, text="Browse folders...", font=("Arial Bold", 15)) lbl.grid(row=1, column=4, pady=20,padx=20) btn1 = Button(root, text="Browse Unchecked", command=lambda:browse_button()) btn1.grid(column=4,row=7,padx=5,pady=5) btn1 = Button(root, text="Browse Receiving Folders", command=lambda:browse_button2()) btn1.grid(column=4,row=8,padx=5,pady=5) btn1 = Button(root, text="Check for updated files", command=lambda:filechecking()) btn1.grid(column=4,row=9,padx=5,pady=5) # gets paths of folders with these functions def browse_button(): source = filedialog.askdirectory()
text= "tamiento de algunas de las distribuciones más importantes de probabilidad" ).place(x=40, y=75) consi2 = Label(Bienvenido, text="y estadística.").place(x=40, y=95) enjoy = Label(Bienvenido, text="Disfrútalo", font=("Verdana", 20)).place(x=40, y=120) cre = Button(Bienvenido, text="Créditos", command=Creditos).place(x=470, y=128) ########################### GUI ########################### Ventana = Tk() Ventana.title("Distribuciones de Probabilidad") Ventana.geometry("573x200") Ventana.resizable(width=False, height=False) Pestanas = ttk.Notebook(Ventana) Pestanas.pack(fill="both", expand="yes") #Las ventanas se van a expandir en toda la ventana #Creando pestanas Bienvenido = ttk.Frame(Pestanas) Poi = ttk.Frame(Pestanas) Bi = ttk.Frame(Pestanas) Geome = ttk.Frame(Pestanas) Hiper = ttk.Frame(Pestanas) No = ttk.Frame(Pestanas) NA = ttk.Frame(Pestanas) Pestanas.add(Bienvenido, text="Bienvenido") Pestanas.add(Poi, text="Poisson") Pestanas.add(Bi, text="Binomial")