Feb-05-2019, 04:01 PM
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?
