Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 [Tkinter] Tkinter timetabl using treeview
Hi I am trying to create a drag and drop timetable using tkinter and I was wondering if there was a way to create an element in a treeview that expands more than one row,
def changeTime(td):
	hour = td.seconds//3600
	minutes = (td.seconds//60)%60
	if len(str(minutes)) == 1:
		minutes = str(minutes)
		minutes = '0' + minutes
		minutes = str(minutes)
	return "%d:%s" % (hour,minutes)

table = ttk.Treeview(sistema)
table['show'] = 'headings'
table['columns'] = ('E', 'H', 'Mo', 'Tue', 'We', 'Thu', 'F')
table.heading('E', text="Events")
table.heading('H', text="Hours")
table.heading('Mo', text="Monday")
table.heading('Tue', text="Tuesday")
table.heading('We', text="Wednesday")
table.heading('Thu', text="Thursday")
table.heading('F', text="Friday")

time = datetime.timedelta(hours = 7)
half = datetime.timedelta(minutes = 30)

for i in range(20):
	table.insert("", i, values=('', changeTime(time)))
	time = time + half

table.pack(side=LEFT, expand=YES, fill=BOTH)
Currently that is my table but what I need to do is create an element in events that lasts 1:30 hours, is this possible using treeview or am I wasting my time with this?, if so can you recommend another way to approachj this?
Please include enough code to run.
Treeview can be expanded. Here's an example i wrote a while back, with multiple columns
the scraping part of this may need updating as web sites change over time, but the GUI code
is still good.
Hi Thanks for answering but I need it to be multiple rows not columns
Quote:Hi Thanks for answering but I need it to be multiple rows not columns
Since a 'tree' is by default multiple rows, or course a 'treeview' can hold multiple rows!

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  [Tkinter] Not getting entry values on button click & treeview not updating ? swanysto 4 370 May-10-2019, 04:16 PM
Last Post: swanysto
  [Tkinter] Image does not show in treeview. KevinBrown 3 251 May-05-2019, 11:47 PM
Last Post: KevinBrown
  sQlite3 output to tkinter treeview - how do I set / increase width of the output? dewijones67 5 571 Jan-23-2019, 08:45 AM
Last Post: Larz60+
  [Tkinter] I need to know how to put my SQLite3 data into a Treeview Thename921 1 662 Jan-12-2019, 10:26 PM
Last Post: Larz60+
  [Tkinter] Treeview automatically adjust it's size when pack inside frame Prince_Bhatia 1 3,554 Jul-25-2018, 03:24 AM
Last Post: Larz60+
  bind hover on tkinter.ttk.Treeview Larz60+ 4 5,191 May-20-2017, 10:28 AM
Last Post: Larz60+

Forum Jump:

Users browsing this thread: 1 Guest(s)