[Tkinter] Tkinter timetabl using treeview - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: GUI (https://python-forum.io/forum-10.html) +--- Thread: [Tkinter] Tkinter timetabl using treeview (/thread-15898.html) |
Tkinter timetabl using treeview - mntfr - Feb-05-2019 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? RE: Tkinter timetabl using treeview - Larz60+ - Feb-05-2019 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. RE: Tkinter timetabl using treeview - mntfr - Feb-05-2019 Hi Thanks for answering but I need it to be multiple rows not columns RE: Tkinter timetabl using treeview - Larz60+ - Feb-05-2019 Quote:Hi Thanks for answering but I need it to be multiple rows not columnsSince a 'tree' is by default multiple rows, or course a 'treeview' can hold multiple rows! |