def makeMenuBar(self, tk: Tkinter): menu = Tkinter.Menu(master=tk, bg='white') tk.config(menu=menu) file = Tkinter.Menu(menu) # add the exit option file.add_command(label='Exit', command=lambda: exit()) # put a file menu menu.add_cascade(label='File', menu=file)
def start(): window = Tk() window.title('BattleShips with AI') window.geometry('500x500') menu = Menu(window) new_item = Menu(menu) new_item.add_command(label='New') new_item.add_command(label='Exit') menu.add_cascade(label='File', menu=new_item) window.config(menu=menu) lbl = Label(window, text='Enter your positions', font=('Helvetica', 25)) lbl.grid(column=0, row=0) ship5 = Entry(window, width=6) ship5.grid(column=1, row=0) ship4 = Entry(window, width=6) ship4.grid(column=1, row=1) ship3_1 = Entry(window, width=6) ship3_1.grid(column=1, row=2) ship3_2 = Entry(window, width=6) ship3_2.grid(column=1, row=3) ship2 = Entry(window, width=6) ship2.grid(column=1, row=4)
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()
import tkinter as Tk root = Tk() root.wm_title("Login Window") root.config(background="#FFFFFF") class Application(Frame): def __init__(self, master): super(Application, self).__init__(master) #Set __init__ to the master class self.grid() self.create_main() #Creates function def create_main(self): print("testing") #Title self.title = Label(self, text=" Login Form ") self.title.grid(row=0, column=2) #Username Label self.user_entry_label = Label(self, text="Username: "******"Password: ") self.pass_entry_label.grid(row=2, column=1) #Password Entry Box self.pass_entry = Entry(self) self.pass_entry.grid(row=2, column=2) #Sign In Button
def quiz(): mat = Tk() global count, score score = 0 count = 0 mat.geometry("800x400") mat.title("Maths Quiz") mat.config(bg="Yellow") def ask_question(): global score, count qq = get_questions("maths.json") score_readout = Label(mat, text="Score: " + str(score) + "/" + str(count), font=(None, 15), fg="Blue", bg='yellow') score_readout.pack(side='top', anchor='e') spacing_label = Label(mat, text="", font=(None, 15), fg="blue", bg="yellow") spacing_label.pack() eh1 = Label(mat, text="Question " + str(count + 1), font=(None, 15), fg="Blue", bg='yellow') eh1.pack(side='top', anchor='w') question_label = Label(mat, text=qq[4], font=(None, 10), bg='yellow', wraplength='750') question_label.pack(side='top', anchor='w') def correct(): global score, count mixer.init(22050, -8, 4, 65536) mixer.music.load('rr.ogg') mixer.music.play(0) score = score + 1 count = count + 1 unpack_all() if count < 10: ask_question() else: end_score = str(score) + " / " + str(10) messagebox.showinfo( "Score", "Your Score Was: %s" % score + " Out of 10") mat.destroy() def incorrect(): global count, score mixer.init(22050, -8, 4, 65536) mixer.music.load('ww.ogg') mixer.music.play(0) count = count + 1 unpack_all() if count < 10: ask_question() else: end_score = str(score) + "/" + "10" messagebox.showinfo( "Score", "Your Score Was: %s" % score + " Out of 10") score = 0 count = 0 end_score = 0 mat.destroy() spacing_label2 = Label(mat, text="", font=(None, 15), fg="blue", bg="yellow") spacing_label2.pack() def unpack_all(): for mat_b in bttns: mat_b.pack_forget() score_readout.pack_forget() eh1.pack_forget() question_label.pack_forget() spacing_label.pack_forget() spacing_label2.pack_forget() mat_b1 = Button(mat, text=qq[0], command=correct, font=(None, 12), width=80, bg='gold', fg='blue') mat_b2 = Button(mat, text=qq[1], command=incorrect, font=(None, 12), width=80, bg='gold', fg='blue') mat_b3 = Button(mat, text=qq[2], command=incorrect, font=(None, 12), width=80, bg='gold', fg='blue') mat_b4 = Button(mat, text=qq[3], command=incorrect, font=(None, 12), width=80, bg='gold', fg='blue') bttns = [mat_b1, mat_b2, mat_b3, mat_b4] shuffle(bttns) for mat_ in bttns: mat_.pack(side='top', anchor='w') ask_question() mat.mainloop()
mat_.pack(side='top', anchor='w') ask_question() mat.mainloop() quiz() menu = Menu(root) filemenu = Menu(menu, tearoff=0) filemenu.add_command(label="Credits") # filemenu.add_command(label="Save") filemenu.add_separator() filemenu.add_command(label="Exit", command=root.destroy) menu.add_cascade(label="File", menu=filemenu) root.config(menu=menu) h1 = Label(root, text="Revision Quiz", font=(None, 40), fg="black") h1.pack() logo = ImageTk.PhotoImage(Image.open("logo.png")) # logo2 = ImageTk.PhotoImage(Image.open("big_1489974512_image.jpg")) # root.config(image=logo2) panel = Label(root, image=logo) panel.pack(side="bottom", fill="y", expand="yes") bt1 = Button(root, text="English", bg="blue", command=english, font=(None, 20)) bt1.pack() bt1.config(height=1, width=30) bt2 = Button(root, text="Maths", bg="blue", command=math, font=(None, 20)) bt2.pack() bt2.config(height=1, width=30) bt3 = Button(root, text="Science", bg="blue", command=science, font=(None, 20))
load = Button(main, text ='Load VCF', font = "Helevtica 16 bold", cursor="circle",command = open_vcf, bg = orangedark, fg = "white", bd = 0.2 , pady = 4, padx = 5) label2 = Label(main, bg=bluedark, font = "helevtica 10 italic") label = Label(main, text="Welcome on Kofi.dev", bg = blue, font = "helevtica 10 italic") #PLacement de l'interface back.place(rely = 0.4, relx = 0.4 , height = 300, width = 300 ) #back2.place(rely = 0.4, relx = 0.4 , height = 200, width = 200 ) load.place(rely = 0.4, relx = 0.4 , height = 150, width = 150 ) #Entête du programme label2.place(relheight = 0.05,relwidth = 1,rely = 0) label.place(relwidth = 1, rely = 0 ) # Création d'un menu sur la fenêtre menubar = Menu(main) menu1 = Menu(menubar, tearoff=0) menu1.add_command(label="About kofi", command = openweb) menu1.add_command(label="User guide", command = openweb2) menubar.add_cascade(label="Help", menu=menu1) #Attribution du menu au main main.config(menu=menubar) # Placement de l'horloge clock = Label(main, font=('times', 20, 'bold'), bg='white', fg= bluedark) clock.place(rely = 0.85, relx = 0.85) hour() main.mainloop()
canvas.pack() """ p = PanedWindow(interface, orient=HORIZONTAL) p.pack(side=TOP, expand=N, fill=BOTH, pady=20, padx=2) p.add(canvas.pack()) p.add(Label(p, text='Projet de M1\nFreeDoM Tools\n2018-2019\n', background='white', anchor=CENTER,width=25) ) p.add(canvas.pack()) p.pack() """ menu1 = Menu(menubar, tearoff=0, font=("bold",10)) menu1.add_command(label="Sauvegarder", command=Enregistrer) menu1.add_command(label="rien") menu1.add_separator() menu1.add_command(label="Quitter", command=interface.quit) menubar.add_cascade(label="Fichier", menu=menu1) interface.config(menu=menubar) var_label = StringVar() label = Label(interface, text="Projet de M1\nFreeDoM Tools\n2018-2019\n", font=("bold",10)) label.pack() bouton=Button(interface, text="Parcourir",command = Parcourir, width="20", height="3",font=("bold",15),bg="#0d4fba", activebackground="#75b1ea", relief="flat") bouton = bouton.pack() label=Label(interface,textvariable=var_label, font=("bold",15), width="20", height="3").pack() var_label.set(' ') interface.mainloop()
def Create(): root=Tk() root.geometry("700x500") f2=Frame(root) f3=Frame(root) def menu1(): class Admin(Frame): def __init__(self, parent): self.parent=parent self.initialize_user_interface() def create(self): global i i=1 self.tree.delete(*self.tree.get_children()) cursor.execute("select * from movie") results = cursor.fetchall() for row in results: x = row[0] y=row[1] z=row[2] valuelist = [y,z,x] i=i+1 self.tree.insert('', 'end',values=(valuelist), tags='cold',text=x) def initialize_user_interface(self): global selected global selected2 global selected3 self.parent.grid_rowconfigure(0,weight=1) self.parent.grid_columnconfigure(0,weight=1) self.parent.config(background="lavender") self.dose_label =Label(self.parent ,text = "Movie Name") self.dose_entry = Entry(self.parent) self.dose_label.place(x=50,y=10) self.dose_entry.place(x=250,y=10) self.dose_label2 =Label(self.parent ,text = "Date",width=20) self.dose_label2.place(x=50,y=40) options = ["2018","2019","2020","2021","2022","2023","2024","2025","2026"] selected = StringVar(value="Year") op=OptionMenu(self.parent, selected, *(options)) op.place(x=250,y=40) options2 = ["1","2","3","4","5","6","7","8","9","10","11","12"] selected2 = StringVar(value="Month") op2 = OptionMenu(self.parent, selected2, *(options2)) op2.place(x=320,y=40) op2.config(width=5) options3 = ['1','2','3','4','5','6','7''8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31'] selected3 = StringVar(value="Date") op3 = OptionMenu(self.parent, selected3, *(options3)) op3.place(x=400,y=40) self.submit_button = Button(self.parent, text = "Insert", bd=4,command = self.insert_data) self.submit_button.place(x=250,y=100) self.b=Button(self.parent, fg='blue',text="Update",bd=4,command=up1).place(x=300,y=100) # Set the treeview self.tree = ttk.Treeview( self.parent, columns=('Movie', 'date')) self.tree.heading('#0', text='ID') self.tree.heading('#1', text='movie') self.tree.heading('#2', text='Date') self.tree.column('#1', stretch=YES) self.tree.column('#2', stretch=YES) self.tree.column('#0', stretch=YES) self.tree.place(x=10,y=130) self.treeview = self.tree self.create() # Initialize the counter self.i = 0 def insert_data(self): self.treeview.insert('', 'end', text=""+str(i), values=(self.dose_entry.get(),str(selected.get()+"-"+selected2.get()+"-"+selected3.get()))) a=str(selected.get()+"-"+selected2.get()+"-"+selected3.get()) b=self.dose_entry.get() cursor.execute("""INSERT INTO movie VALUES (%d,'%s','%s')"""%(i,b,a)) row= cursor.fetchone() conn.commit() def retur(self): a=str(selected.get()+"-"+selected2.get()+"-"+selected3.get()) b=self.dose_entry.get() l=list(a,b) return(l) def main(): f2.pack(fill=BOTH, expand=1) d=Admin(f2) root.mainloop() if __name__=="__main__": main() def menu4(): c.delete("all") c.create_rectangle(200,25,700,150,fill="Red") label1.config(text="It is a rectangle ") def det(): top=Tk() dose_label =Label(top ,text = "Movie Name") dose_entry = Entry(top) dose_label.place(x=0,y=10) dose_entry.place(x=90,y=10) modified_label = Label(top, text = "ID ") modified_entry =Entry(top) modified_label.place(x=0,y=60) modified_entry.place(x=90,y=60) b3=Button(top, fg='blue',text="Delete",bd=4).place(x=30,y=90) def up1(*args): def up12(): cursor.execute("update movie set movie_nm='%s' , movie_date='%s' where movie_id=%d"%(b,a,int(modified_entry.get()))) row= cursor.fetchone() dose_label =Label(root,text = "Movie Name") dose_entry = Entry(root) dose_label.place(x=50,y=10) dose_entry.place(x=250,y=10) dose_label2 =Label(root ,text = "Date",width=20) dose_label2.place(x=50,y=40) options = ["2018","2019","2020","2021","2022","2023","2024","2025","2026"] selected = StringVar(value="Year") op=OptionMenu(root, selected, *(options)) op.place(x=250,y=40) options2 = ["1","2","3","4","5","6","7","8","9","10","11","12"] selected2 = StringVar(value="Month") op2 = OptionMenu(root, selected2, *(options2)) op2.place(x=320,y=40) op2.config(width=5) options3 = ['1','2','3','4','5','6','7''8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31'] selected3 = StringVar(value="Date") op3 = OptionMenu(root, selected3, *(options3)) op3.place(x=400,y=40) b2=Button(root ,fg='blue',text=" DATE ",bd=4,command=up12).place(x=300,y=100) modified_label = Label(root, text = "ID ") modified_entry =Entry(root) modified_label.place(x=50,y=80) modified_entry.place(x=250,y=80) a=str(selected.get()+"-"+selected2.get()+"-"+selected3.get()) b=dose_entry.get() def user(): class user_det(Frame): def create(self): a=[] self.tree.delete(*self.tree.get_children()) cursor.execute("select ID from user") results = cursor.fetchall() cursor.execute("select usr_ID from user_mov") row = cursor.fetchall() k=0 for i in results: if i in row: a.append(1) else: a.append(0) for i in range(len(a)): w=i+1 cursor.execute("select user_nm from user where ID=%d"%w) rp = cursor.fetchone() if a[i]==1: z=i+1 cursor.execute("select movie_id,thea_nm from user_mov where usr_ID=%d"%z) results = cursor.fetchone() r=results[0] cursor.execute("select movie_dt from movie where movie_id=%d"%r) rk = cursor.fetchone() p=results[1] cursor.execute("select movie_nm from movie where movie_id=%d"%(int(r))) x= cursor.fetchone() self.tree.insert('', 'end', text="", values=(rp,x,rk,p)) else: self.tree.insert('', 'end', text="", values=(rp,'NOT BOOK','NOT BOOK','NOT BOOK')) def __init__(self, parent): self.parent=parent self.initialize_user_interface() def initialize_user_interface(self): self.parent.grid_rowconfigure(0,weight=1) self.parent.grid_columnconfigure(0,weight=1) self.parent.config(background="lavender") win2 = Toplevel() new_element_header=['1st','2nd','3rd','4th'] treeScroll = ttk.Scrollbar(win2) treeScroll.pack(side=RIGHT, fill=Y) self.tree = ttk.Treeview(win2,columns=new_element_header, show="headings", yscrollcommand = treeScroll) self.tree.heading('#0', text='Item') self.tree.heading('#1', text='User name') self.tree.heading('#2', text='Movie') self.tree.heading('#3', text='Date') self.tree.heading('#4', text='Theater') self.create() self.tree.pack(side=LEFT, fill=BOTH) # Initialize the counter self.i = 0 def insert_data(self): self.treeview.insert('', 'end', text="Item_"+str(self.i), values=(self.dose_entry.get()+" mg", self.modified_entry.get())) self.i = self.i + 1 def main(): root.geometry("500x500") f3.pack(fill=BOTH, expand=1) d= user_det(f3) root.mainloop() if __name__=="__main__": main() def log(): root.destroy() menubar=Menu(root) menubar=Menu(root) filename1=Menu(menubar) filename2=Menu(menubar) filename1.add_command(label="INSERT",command=menu1) filename1.add_command(label="Delete",command=det) filename2.add_command(label="SHOW USER",command=user) menubar.add_cascade(label="MOVIE",menu=filename1) menubar.add_cascade(label="USER",menu=filename2) menubar.add_cascade(label="LOGOUT",command=log) root.config(menu=menubar) root.mainloop() root.mainloop()
menubar.add_cascade(label="START", menu=editmenu) filemenu = Menu(menubar, tearoff=0) filemenu.add_command(label="Admin", command=d.admin) filemenu.add_command(label="User",command=d.user) menubar.add_cascade(label="SINGIN", menu=filemenu) helpmenu = Menu(menubar, tearoff=0) helpmenu.add_command(label="Help Index") helpmenu.add_command(label="Licence") helpmenu.add_separator() helpmenu.add_command(label="About...") menubar.add_cascade(label="HELP", menu=helpmenu) menubar.add_cascade(label="FEEDBACK",command=feed) h2 = Menu(menubar, tearoff=0) h2.add_command(label="Logout",command=d.logout) menubar.add_cascade(label="SINGOUT",menu=h2) top.config(menu=menubar) #end of menu f0.pack(fill='both', expand='yes') #----------------------------registration code ------------------------------------------------------------------------------------ def insert(): use_nm=five.get() passw=six.get() phone=three.get() cus_id=seven.get() cursor.execute("select * from user") results = cursor.fetchall() try: for row in results: y = row[2] x= row[0] if(y==use_nm or x==cus_id):
location.upper(), date_time))) lb3.config(text=str("Current Weather Description:" + str(weather_desc))) lb4.config(text=str("Current Humidity :" + str(hmdt) + "%")) lb5.config(text=str( "Current Temperature is: {:.2f}\N{DEGREE SIGN}C ".format(temp_city))) lb6.config(text=str("Current Wind Speed:" + str(wnd_spd) + "kmph")) if temp_city > 15: master.configure(bg="orange") else: master.configure(bg="powder blue") master = Tk() master.title('Weather App') master.config(bg="cadet blue", relief="solid") master.geometry("700x600") lbheading = Label(master, text="My Weather App", font="arial 22 bold", bg='powderblue') lbheading.pack() lb1 = Label(master, text="Enter City:", font='arial 18 bold') lb1.pack(pady=20) en1 = Entry(master) en1.pack(pady=20) checkbutton = Button(master, text="Search", font="bold", command=weather_app)
class WCUI: window = "" Sc_height = 0 Sc_width = 0 def __init__(self): self.window = Tk() self.window.title("Web Customizer") self.window.geometry('800x800') self.window.config(bg="white") self.window.overrideredirect(False) self.Sc_height = self.window.winfo_screenheight() // 2 self.Sc_width = self.window.winfo_screenwidth() // 2 self.window.geometry(f"{self.Sc_width}x{self.Sc_height}") print(self.Sc_height) self.nlpObject = Nlp() self.htmlObject = html_writer() def makeChanges(self, changes): if (len(changes) >= 3 and not (changes == None) and not (changes == "")): print(changes) self.nlpObject.proccessInput(changes) def resetpage(self): self.htmlObject.file_writer() def clearEntry(self, inputText): self.inputText.delete(0.0, 23.0) def mainmenu(self): myFont = font.Font(size=15) self.inputText = Text(self.window, height=self.Sc_height, width=self.Sc_width, bg="black", fg="white", insertbackground='white') self.inputText['font'] = myFont self.inputText.insert(0.0, 'Type changes need here ...') self.inputText.bind("<Button-1>", self.clearEntry) self.inputText.place(relx=0, rely=0) resetbutton = Button(self.window, text="Reset Webpage", width=400, bg="yellow", fg="black", command=lambda: self.resetpage()) resetbutton['font'] = myFont resetbutton.pack(side=BOTTOM) button = Button(self.window, text="Apply Changes", width=500, bg="blue", fg="white", command=lambda: self.makeChanges( self.inputText.get("1.0", "end-1c"))) button['font'] = myFont button.pack(side=BOTTOM) self.window.mainloop()