Here's the definition of the parent display control - using a Tkinter Treeview with added scoll bars and an action binding for when a row is selected. I won't cover the SQLite parts, so I'm assuming the simple SQL SELECT statements are familiar - but do ask if you'd like those explained. 3 the command to create scrollbar: sb Scrollbar (frame, orientVERTICAL) we are placing this widget in frame orient decides whether scrollbars will be horizontal or vertical. I'll let the README at the respository speak for itself, but will here discuss some of the vital parts. Python Tkinter Treeview Scrollbars 1 The best practice to implement a scrollbar is by using a frame widget. By the way, if you are unhappy with tkinter's default name for the items, you can name them yourself: tree.insert ('', 'end', 'itemi' i, textstr (i)). But then I decided it was unfair of me to moan about examples having unnecessary things in them - unless I tried doing that myself. It's just that I have made a lot of change of my data table, and I want to update it on Treeview the easy way by update it all at once, instead of changing it values one by one. I first made my own rebuild as a way to test what I'd gleaned - using my usual stock interfacing (that's elsewhere in my GitLab presence). I also felt a chance was missed to enact a parent-child behaviour between the two tables. My many thanks to them for sharing that, but I wasn't pleased with the amount of code I had to wade through just to find the parts that made and loaded the records and then responded to which was clicked. It came about after I recently watched a YouTube video by Data Analytics Ireland. In short: you can find the code at this online Git repository where there's really just the one Python file. The idea here is to show a minimal-imports method of displaying parent-child records using the stock Tkinter and SQLite Python libraries. I've made an example Python program that does nothing more than load two tables into a form and then lets you filter the "child" records by selecting rows in the "parent" table.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |