Python Forum
[Tkinter] Tkinter timetabl using treeview
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Tkinter timetabl using treeview
#1
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
	else:
		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?
Reply
#2
Please include enough code to run.
Treeview can be expanded. Here's an example i wrote a while back, with multiple columns
https://github.com/Larz60p/CaliforniaPublicSalaries
the scraping part of this may need updating as web sites change over time, but the GUI code
is still good.
Reply
#3
Hi Thanks for answering but I need it to be multiple rows not columns
Reply
#4
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!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  tkinter - update/refresh treeview snakes 5 20,560 Dec-02-2023, 07:05 PM
Last Post: aynous19
  [Tkinter] How to insert data json to treeview tkinter? Shakanrose 8 4,213 Jan-19-2023, 03:58 PM
Last Post: Shakanrose
  [Tkinter] Different rows colours in treeview tkinter Krissstian 1 1,190 Nov-20-2022, 09:59 PM
Last Post: woooee
  [Tkinter] About Tkinter Treeview.selection_get() usage. water 3 8,151 Feb-12-2022, 02:19 PM
Last Post: water
  [Tkinter] [split] Is there a way to embed a treeview as a row inside another treeview? CyKlop 5 3,304 Oct-20-2021, 12:14 AM
Last Post: CyKlop
  [Tkinter] acceleration of data output in treeview tkinter Vladimir1984 4 4,097 Nov-21-2020, 03:43 PM
Last Post: Vladimir1984
  sQlite3 output to tkinter treeview - how do I set / increase width of the output? dewijones67 5 6,576 Jan-23-2019, 08:45 AM
Last Post: Larz60+
  bind hover on tkinter.ttk.Treeview Larz60+ 4 14,932 May-20-2017, 10:28 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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