Python Tutorials

0

Python Program on grid() vs pack() vs place() Methods in Tkinter

Program 1 from tkinter import * my_root=Tk() my_root.geometry(‘500×500’) my_root.title(‘Container add option’) my_root.wm_iconbitmap(‘2.ico’) my_root.maxsize(500,500) my_root.minsize(500,500) mf=Frame(width=500,height=500,bg=’yellow’) mf.pack() lb1=Label(mf,text=”Employee Id:”,font=’Arial,10,bold’,bg=’yellow’) #lb1.pack() lb1.place(x=50,y=50) lb2=Label(mf,text=”Employee Name:”,font=(‘Arial,10,bold’),bg=’yellow’) lb2.place(x=45,y=100) txt1=Entry(mf,font=(‘Arial,10,bold’)) txt1.place(x=150,y=50) txt2=Entry(mf,font=(‘Arial,10,bold’)) txt2.place(x=170,y=100) my_root.mainloop() #Grid Application # lb1=Label(text=”Employee Id:”,font=’Arial,10,bold’) #...

0

Python Program on grid() Method in Tkinter

Program 1 from tkinter import * my_root=Tk() my_root.geometry(‘500×500’) my_root.title(“Entry Window”) my_root.wm_iconbitmap(‘2.ico’) lb1=Label(text=”Enter a number”,font=(‘Arial’,15,’bold’)) strvalue=StringVar() txt1=Entry(textvariable=strvalue ,font=(‘Arial’,15,’bold’),fg=’red’) btn1=Button(text=”Click here”,font=(‘Arial’,10,’bold’),fg=’blue’) lb1.grid(row=0,column=0) txt1.grid(row=0,column=1) btn1.grid(row=1,column=0) my_root.mainloop()  

0

How to Validate an Entry Widget as an Integer in GUI in Python

Program 1 from tkinter import * def click(n): if(n==1): n=mynum.get() f=1 while(n!=0): f=f*n n=n-1 #print(“Factorial is “,f) lb3[“text”]=”Factorial is: {}”.format(f) if(n==2): n=mynum.get() s=0 while(n!=0): r=n%10 s=s*10+r n=n//10 #print(“Factorial is “,f) lb3[“text”]=”Reverse is: {}”.format(s) my_root=Tk()...

0

How to Use Entry Control with Events in Python

Program 1 from tkinter import * class MyEntry: def __init__(self,myroot): self.mf=Frame(myroot,width=500,height=500,bg=’yellow’) self.mf.pack() self.mf.propagate(0) self.lb1=Label(self.mf,text=”Enter a String:”,font=(‘Arial,10,bold’)) self.lb1.place(x=50,y=100) self.strv=StringVar() self.txt1=Entry(self.mf,show=’*’, font= (‘Arial,13,bold’),fg=’red’,textvariable=self.strv) self.txt1.place(x=150,y=100) self.txt1.bind(‘<Return>’,self.display) self.btn1=Button(self.mf,text=”Click Here”,font=(‘Arial,10,bold’),command=lambda :self.display(0)) self.btn1.place(x=50, y =200) self.lb2 = Label(self.mf, text=”-“, font=(‘Arial,10,bold’))...

0

How to Set Frame in Root in Python

Embarking on the journey of Python GUI development, we shift our focus to setting frames within the root window using Tkinter. Frames serve as essential containers, allowing us to organize and structure the GUI...

0

Python Program on Daemon Thread

Venturing into the realm of Python’s practical applications, our focus turns to Daemon Threads in the context of multithreading. Daemon Threads are special threads designed to run in the background, providing auxiliary functionality without...