Skip to main content

Posts

Showing posts with the label tkinter

how to add the data from list to the treeview in tkinter

 Here in this blog we are going to make the window where we can send all the data from the list to the treeview form. here is the following codes from tkinter import * from tkinter import ttk import sqlite3 root = Tk () root . geometry ( "500x600" ) #add some stylr style = ttk . Style () #Pick a theme style . theme_use ( "default" ) style . configure ( "Treeview" ,                 background = "white" ,                 foreground = "black" ,                 rowheight = 25 ,                 fieldbackground = "white" ) #change selected colour style . map ( 'Treeview' , background =[( 'selected' , 'blue' )]) #create treeview frame tree_frame = Frame ( root ) tree_frame . pack ( pady = 20 ) #treeview scrollbar tree_scroll = Scrollbar ( tree_frame ) tree_scroll . pack ( side = RIGHT , fill = Y ) #Create treeview my_tree = ...

Creating designed pages in tkinter

Here in this blog we can make the creative pages in tkinter for the entry section   So here are the following codes for that:- from tkinter import * user_form = Tk () user_form . geometry ( "750x450" ) user_form . title ( "Register form" ) user_form . resizable ( 0 , 0 ) pic1 = PhotoImage ( file = "user_form.png" ) user_form1 = Label ( user_form , image = pic1 , width = 750 , height = 450 ) user_form1 .image= pic1 user_form1 . pack () name_en = Entry ( user_form , width = 14 , relief = "flat" , font =( "times" , 20 )) name_en . place ( relx = 0.385 , rely = 0.265 ) user_en = Entry ( user_form , width = 19 , relief = "flat" , font =( "times" , 20 )) user_en . place ( relx = 0.385 , rely = 0.365 ) psswd_en = Entry ( user_form , width = 18 , relief = "flat" , font =( "times" , 20 )) psswd_en . place ( relx = 0.385 , rely = 0.485 ) pic3 = PhotoImage ( file = "register.png" ) but1 = Button...

treeview ka branch wala form in python

 in this blog we are going to make the treeview form with the different branches in it so here are the following images to represent the data # Python program to illustrate the usage # of hierarchical treeview in python GUI # application using tkinter # Importing tkinter from tkinter import * # Importing ttk from tkinter from tkinter import ttk # Creating app window app = Tk () # Defining title of the app app . title ( "GUI Application of Python" ) # Defining label of the app and calling a geometry # management method i.e, pack in order to organize # widgets in form of blocks before locating them # in the parent widget ttk . Label ( app , text = "Treeview(hierarchical)" ). pack () # Creating treeview window treeview = ttk . Treeview ( app ) # Calling pack method on the treeview treeview . pack () # Inserting items to the treeview # Inserting parent treeview . insert ( '' , '0' , 'item1' ,                 text = 'GeeksforGeeks...

How to add the treeview numbers to get the grand total in tkinter entry box

 in this blog we are going to know about the adding of the integers in the treeview and get the total in the entry box of tkinter so here is the image first so the coding to do such things are here as follow but here is the condition that pls make assured that the state of entry box is disabled.......      for child in my_tree1 . get_children ():         e2l . config ( state = "normal" )         b1 += float ( my_tree1 . item ( child , "values" )[ 3 ])         var2 . set ( b1 )         e2l . config ( state = "disable" )      l2l = Label ( ento , text = "Purnea-2" , width = 8 )      l2l . grid ( row = 0 , column = 1 )     e2l = Entry ( ento , textvariable = var2 , state = "disable" , width = 8 )     e2l . grid ( row = 1 , column = 1 )

how to put an image in the tkinter window

 Here in this blog we are going to make a window with the image attached in it. So this type of procedure is done by this coding which has been shown below:- from tkinter import * root = Tk () root . geometry ( "900x450" ) pici = PhotoImage ( file = "hit.png" ) pici_label = Label ( root , image = pici ) pici_label .image= pici pici_label . pack () root . mainloop () So this is the particularly attached file according to the coding means this is the hit.png

how to create a menu bar in Tkinter

 In this blog we are going to explain about the creating the menu bar in Tkinter  Here in the Image you can see that how the file ,edit and help menus are open there in the window so the same will happen in the codings below...... from tkinter import Toplevel , Button , Tk , Menu     top = Tk ()   menubar = Menu ( top )   file = Menu ( menubar , tearoff = 0 )   file . add_command ( label = "New" )   file . add_command ( label = "Open" )   file . add_command ( label = "Save" )   file . add_command ( label = "Save as..." )   file . add_command ( label = "Close" )     file . add_separator ()     file . add_command ( label = "Exit" , command = top . quit )     menubar . add_cascade ( label = "File" , menu = file )   edit = Menu ( menubar , tearoff = 0 )   edit . add_command ( label = "Undo" )     edit . add_separator ()     edit . add_command ( label = "Cut" )   ed...

create tab in python tkinter

 Here in this blog we are going to create tab in tkinter ========================================================================== from tkinter import * from tkinter import ttk root = Tk () s = ttk . Style () s . configure ( "TNotebook.Tab" , font =( "times new roman" , "14" , "bold" )) tabControl = ttk . Notebook ( root ) tab1 = Frame ( tabControl ) tab2 = Frame ( tabControl ) tabControl . add ( tab1 , text = "entry with listbox" ) tabControl . add ( tab2 , text = "database entry" ) tabControl . pack () root . mainloop ()

Auto list with entry box and database and even the concatenation of data

 Here in this blog, we are having some objectives which you will see here pointwise create Tkinter then create two tabs  in a second tab, I have created a database entry system and I have also concatenated the two databases into one. And after that we have called the concatenated item in the list box and then automated the Listbox ==========================================================================                                                                                      ======================================================================== And here is the following code from tkinter import * import sqlite3 from tkinter import ttk root = Tk () root . geometry ( "400x500" ) root . title ( "auto society" ) conn = sqlite3 . connect ( "society...