ALLBLOG ABOUT CODING AND CODE: Python tkinter basic

Monday, 4 January 2021

Python tkinter basic

What is Tkinter ?     Tkinter is a library that is pre-installed in python used to make GUI like Calculator,
Login system, Notepad etc. open python idle or pycharm as python ide

and make a new file name main.py,  Start typing

from tkinter import*   -  "this import all tools from tkinter

 root = Tk()      - "root is the name Tk "  *note always the first letter of Tk is capital

root.mainloop() - "type the name of tk+.mainloop(),  mainloop() is used to run your application"

Setting the geometry or size of tkinter window -
 TYPE
 root.geometry("1000x500+0+0")  -  ("width" x "length" + "x position" + "y position")
Changing title of tkinter window -
 TYPE 
root.title("tkinter") - 
("type your title here")
Using minsize and maxsize 

root.minisize(200,200) - ("width" ,
 "length") -
 this will set
 the minimum size of window, window
 size dose not get smaller than this
 size

root.maxsize(1300,600) -
 ("width" , "length") -
 this will set the maximum size of 
window, window size dose not get 
larger than this size
Making button 

Button name like
btn=Button(root,text="click") - Button this 
is thinter function that define we are making a button (where you want to place,text is used to put text on button)

and to see button in tkinter window we will to pack button there are two method to pack
1. button name.pack() - btn.pack()

2. btn=Button(root,text="click").pack()

  to be continued...(about tools)

1 comment:

Use of Entry , .get() , .set(), reading and writing data , entry in python

Now we are learning about .get func ,.set() and entry func reading/writing files wit python Entry to take input from user To use it type guy...