How To Install Tkinter Using Pip
tkinter_page
Introduction
Tkinter_page is based on tkinter. Information technology contains several frames that used in spcific area. You can build you lot user interface faster with tkinter_page.
Example
DesktopFrame
#This is a instance to build an DesktopFrame. import tkinter as tk import tkinter_page every bit tkp window = tk . Tk () # Way1: Generate child frame before DesktopFrame by building a dict bar_frame = { "background" : "gold" , "width" : 400 , "summit" : thirty } files_frame = { "groundwork" : "crimson" , "width" : lxx , "pinnacle" : 200 } # Generate a DesktopFrame bframe = tkp . DesktopFrame ( window , log = True , bar_frame = bar_frame , files_frame = files_frame ) # Way2: Generate child frame afterwards DesktopFrame past building a dict details_frame = { "background" : "green" , "width" : 260 , "superlative" : 200 } bframe . set_details_frame ( details_frame ) bframe . set_attributes_frame ({ "background" : "blueish" , "width" : seventy , "height" : 200 }) # Way3: Generate child frame subsequently DesktopFrame by building a frame # If youo employ the third way, exist careful that you should ascertain the master. # -------------------------------------------------------------- # | master | child frame | # | base_frame | bar_frame, logs_frame | # | mid_frame | files_frame, details_frame, attributes_frame | # -------------------------------------------------------------- logs_frame = tk . Frame ( bframe . base_frame , groundwork = "black" , width = 400 , height = 40 ) bframe . set_logs_frame ( logs_frame ) # Pack and Run bframe . pack () window . mainloop ()
Folio
Page can be synthetic past combobox fashion.
#This is a instance 1 to build an Folio. #Using Combobox to flip. import tkinter as tk import tkinter_page as tkp window = tk . Tk () base_frame = tk . Frame ( window ) # First we creat three child pages # Nosotros can creat a pack way for a page def pack_way1 (): impress ( "Use office to ascertain pack way." ) label1 . pack ( fill = 'x' , side = 'bottom' ) child1 = tkp . Page ( base_frame , pack_way = pack_way1 ) label1 = tk . Characterization ( base_frame , text = "child1" , width = 10 , pinnacle = ii ) child1 . add_component ( label1 ) def pack_way2 (): print ( "Auto pack manner is similar this." ) label2 . pack () child2 = tkp . Page ( base_frame , pack_way = pack_way2 ) label2 = tk . Label ( base_frame , text = "child2" , width = 10 , tiptop = 2 ) child2 . add_component ( label2 ) # We can also use machine pack way(practice non need a pack way func) child3 = tkp . Page ( base_frame ) label3 = tk . Label ( base_frame , text = "child3" , width = 10 , height = 2 ) child3 . add_component ( label3 ) # make child page listing child_page = [ child1 , child3 ] child_page_name = [ 'page1' , 'page3' ] # construct male parent folio - load kid page at init page1 = tkp . Page ( base_frame , show_child = True ,\ flip = "Combobox" , child_page = child_page ,\ child_page_name = child_page_name , electric current = 0 ,\ log = False ) label0 = tk . Label ( base_frame , text = "Combobox Flipway Page" , width = 20 , height = 2 ,\ font = ( 'Times' , '15' , 'bold' )) page1 . add_component ( label0 ) # construct father folio - add kid folio at certain place page1 . set_child_page ( child2 , proper noun = 'page2' , fashion = 'Add together' , place = 1 ) # Pack Father Page # yous can also employ # page1.pack(show_child=True) # to auto show the electric current child page base_frame . pack ( fill = 'both' , aggrandize = 1 ) page1 . pack () window . mainloop ()
This is some other folio example with tree style.
#This is a example to build an Page. #Using Buttom (or other components) to flip. import tkinter as tk import tkinter_page as tkp window = tk . Tk () base_frame = tk . Frame ( window ) # make pages like a tree and use components # to flip. # male parent - 1 # \ # 2 - ii.1 # \ two.2 # Be carefull! Tree similar pages construct male parent first! # brand father page begetter = tkp . Page ( base_frame , show_child = False , flip = "Tree" ) label0 = tk . Label ( base_frame , text = "Tree Flipway Page" ,\ width = xl , height = 2 , font = ( 'Times' , '15' , 'bold' )) begetter . add_component ( label0 ) # Method ONE # make page i - STRONGLY NOT RECMMENDED # Of class yous tin add together folio in this way, but this is # STRONGLY Non RECMMENDED! You can use page_connect # function to connect father page and child page. # step ane. Define page1 and its components page1 = tkp . Page ( base_frame , flip = "Tree" ) label1 = tk . Label ( base_frame , text = "page1" ,\ width = 40 , height = 2 , font = ( 'Times' , 'xv' , 'bold' )) page1 . add_component ( label1 ) # step 2. Manual connect father and kid page1 . set_back ( father ) begetter . set_child_page ( page1 ) def to_page1_func (): father . front = begetter . child_page [ 0 ] father . pack_forget () father . front end . pack () to_page1 = tk . Push ( base_frame , text = 'Page ane' , command = to_page1_func ) male parent . add_component ( to_page1 ) # Method TWO # brand page ii # Apply page_connect method - Audo generate Button # step ane. Define page2 and its components page2 = tkp . Page ( base_frame , flip = "Tree" , dorsum = begetter ) label2 = tk . Characterization ( base_frame , text = "page2" ,\ width = twoscore , height = two , font = ( 'Times' , 'fifteen' , 'bold' )) page2 . add_component ( label2 ) # step 2. Use connect function # PS: You lot need to give "master" for generating flip component. tkp . page_connect ( father = father , child = page2 , page_number = 1 ,\ text = 'Page two' , master = base_frame ) # page_number is 1 beacuse in the list - 'begetter.child_page[]', # the 'page2' array subscript is 1. ('page1' is 0.) # Method Three # make page 2.1 - The custom generate Button # step 1. Ascertain page2_1 and its components page2_1 = tkp . Page ( base_frame , flip = "Tree" , dorsum = father ) label2_1 = tk . Label ( base_frame , text = "page2_1" ,\ width = 40 , height = ii , font = ( 'Times' , '15' , 'bold' )) page2_1 . add_component ( label2_1 ) # pace 2. use "widget" to define the flip component. to_page2_1 = tk . Button ( base_frame , text = 'Folio 2_1' ,\ peak = 3 , width = twenty ) tkp . page_connect ( male parent = page2 , child = page2_1 , page_number = 0 ,\ text = 'Folio 2_1' , widget = to_page2_1 ) # Method Four # make page ii.two - The custom generate Button # use "widget" with "flavour" and "command" to define the flip component. # step one. Ascertain page2_2 and its components page2_2 = tkp . Folio ( base_frame , flip = "Tree" , back = begetter ) label2_2 = tk . Label ( base_frame , text = "page2_2" ,\ width = 40 , height = two , font = ( 'Times' , 'fifteen' , 'bold' )) page2_2 . add_component ( label2_2 ) # step 2. utilize "widget" and "flavour" to define the flip component. to_page2_2 = tk . Button ( base_frame ) flavor = { 'text' : 'Page 2_2' , 'tiptop' : 3 , 'width' : twenty } # step 3. use "command" to appand function def hello (): print ( "Hullo!" ) tkp . page_connect ( father = page2 , child = page2_2 ,\ page_number = one , text = 'Page 2_2' , widget = to_page2_2 , season = flavor , command = hello ) base_frame . pack ( fill = 'both' , expand = i ) father . pack () window . mainloop ()
Source: https://pypi.org/project/tkinter-page/
Posted by: donaldsonherry1947.blogspot.com
0 Response to "How To Install Tkinter Using Pip"
Post a Comment