Python Forum
[Tkinter] Frame with treeview
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Frame with treeview
#2
Hi,

************ reposting question as the the forum rules ***********

The code below creates a treeview and frame. Can someone help create some forms that will open in the frame when selecting a treeview node.

i.e when I select A in the treeview node, Form A is then called in the frame and so on....

How is this accomplished in python?

from tkinter import *
from tkinter import ttk
root = Tk()
root.title('Test')
root.iconbitmap()           
PW = ttk.PanedWindow(root, orient=HORIZONTAL)
PW.pack(fill=BOTH, expand=True)

def my_cfm():
    my_label = label(f2,bg=red)
    my_label.pack()

f1 = ttk.Frame(PW, width=75, height=300, relief=SUNKEN)
f2 = ttk.Frame(PW, width=400, height=300, relief=SUNKEN)
PW.add(f1, weight=0)
PW.add(f2, weight=4)
tv = ttk.Treeview(f1)
tv.pack()
tv.insert('', '0', 'item1', text='PRODUCT')

tv.insert('item1', '0', 'A', text='A')

tv.insert('item1', '1', 'B', text='B')
tv.insert('item1', '2', 'C', text='C')
tv.insert('item1', '3', 'D', text='D')
tv.insert('', '1', 'item2', text='REPORTS')

tv.insert('', '3', 'item3', text='QUERIES')
tv.config(height=100)

root.state('zoomed')

tv.mainloop()
Thanks
Reply


Messages In This Thread
Frame with treeview - by virencm - May-24-2021, 07:01 AM
RE: Frame with treeview - by virencm - May-25-2021, 11:01 AM
RE: Frame with treeview - by Yoriz - May-25-2021, 06:48 PM
RE: Frame with treeview - by hopla22 - Feb-01-2022, 09:40 AM
RE: Frame with treeview - by virencm - May-26-2021, 04:36 AM
RE: Frame with treeview - by deanhystad - Feb-01-2022, 04:58 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] [split] Is there a way to embed a treeview as a row inside another treeview? CyKlop 5 5,254 Oct-20-2021, 12:14 AM
Last Post: CyKlop
  [Tkinter] Scrollbar, Frame and size of Frame Maksim 2 11,425 Sep-30-2019, 07:30 AM
Last Post: Maksim
  [Tkinter] create and insert a new frame on top of another frame atlass218 4 15,378 Apr-18-2019, 05:36 PM
Last Post: atlass218
  [Tkinter] Treeview automatically adjust it's size when pack inside frame Prince_Bhatia 1 33,149 Jul-25-2018, 03:24 AM
Last Post: Larz60+
  [Tkinter] Frame size only works if frame is empty(Solved) Tuck12173 7 8,451 Jan-29-2018, 10:44 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020