I know how to create a Listbox using Tkinter but this only allows me to display a list of single items. I need to create a expandable list that allows the user to hit something along the lines of a + next to the item which in turn opens up a new list with + buttons next to each item until you reach the leaf of a list. I was wondering if there was a way to implement this type of expandable list using Tkinter or if not if there was a different Python GUI tool that could do so?
The widget you are looking for is commonly called a "tree" or "hierarchical tree".
If you're using python2.7 or greater you can use ttk.Treeview widget.
For older versions of python you can use Tix.Tree. You can also search for "tkinter tree" on google and you'll find several other variations such as this one.
Related
I am making a user interface with tkinter's treeview and one thing that I want to be able to do with it is to allow the user the ability to change the names displayed by the items whenever they want. However, from what I can tell from the documentation, the function that could do this, set only allows for column values to be changed.
Is there any way to change the text of a treeview item without deleting it and remaking it?
I am trying to automate a self made GUI in python with pywinauto.
I am starting the application with app = Application().start(...) and get the window with dlg = app.top_window_().
In the next step I want to double-click an item from a list. But I do not know how.
I tried to use the Inspect.exe. By clicking on "navigate to children" I get the list which has no name. Clicking again on "navigate to children" shows the name of the item I want to click.
So, how can I refer to this item?
I thought about something like dlg.itemname.double_click(button='left')? I can only find examples in which they are pressing menu entries.
From what you're describing I can assume you use Application(backend="uia") (or must use) because Inspect.exe uses UI Automation technology which is supported by UIA backend in pywinauto.
And yes, you're almost right about double click. This should look so:
dlg.itemname.double_click_input(button='left')
# or
dlg.itemname.click_input(button='left', double=True)
How would I know? Detecting items as separate controls are typical for UIA backend.
For default Win32 backend (what you can see in Spy++ tool) a list view or a list box always have virtual items that are accessible by wrapper methods only, not as separate controls.
I'm building a simple app with python3 and GTK3.0 looking for the correct element for display a layout like the following image
I need display N items this items are load from a database (can be 1000+) and can change (insert, delete, update, etc.) and each item have a complex layout inside (labels, buttons, etc.)
How I can build a layout with a list/grid that dynamically changes.
I've read about GtkTreeView and GtkCellRenderer but i dont know how and other people recommend use GtkBox but how handle a model and update dynamically like ListView/CursorAdapter in android or ListView/Bindings in C#/WPF.
documentation of GTK 3.0 is really poor and does not explain how to extend a widget. another point that the documentation does not explain or at least I have not seen is how to reuse the same element, how to make good use of the resources (memory) when dealing with lots of elements, for example I created a series of widget in glade and I can not use N times. also not possible to create items that are not windows. everything should be within a window. as I can create a different arbitrary element of a window that can be reused.
please when you point me any of the above points, this has an example code can be C #, Python or C + + but it is important to have an example
I've just create a project called 'sqlite-browser' using python3 and gtk. When you display a large number of records in a database, you can use treeview, and add a pager (limit 100/200 records each page). Maybe this project can help you. And here it is: https://github.com/LiuLang/sqlite-browser
This is screenshot:
I'm building a graphical program that will need to show files on both the user's computer and on a remote server. I'm using Tkinter, and I'm definitely a novice with this toolkit. I want to have the files displayed in a box similar to what you would get from a "Details" view in Windows, so that each file has several categories of info(think name, type, size, permissions, etc.) about it and so that the list can be sorted by category, ascending or descending.
What objects in Tkinter (if any) could I use to accomplish this? Is there a tutorial or an existing project that implements something similar with Tkinter?
I'm not sure if my description makes sense, so here's a screenshot of what I want:
TreeView widget should help you
http://www.tkdocs.com/tutorial/tree.html
http://docs.python.org/dev/library/tkinter.ttk.html#ttk-treeview
http://m-eken.com/2010/03/02/treeview-in-python-tkinter/
Yeah , So already has one on this topic
Tk treeview column sort
You should be able to get started from these pointers
On a click of a button named "Add Textbox" it calls a function which creates a single textbox using (gtk.Entry) function. So each time i click that button it creates a textbox. I have a submit button which should fetches all the values of the text boxes(say 10 textboxes) generated with the name of "entry". It works for one textbox but not for multiple. In php we can create dynamix textboxes mentioning as an array name=entry[]. Do we have similar functionality in python ?
Enviroment : FC10 , Glade 3 , Python 2.5 , GTK.
You could be a bit clearer, it's not obvious what you do with your GtkEntry after creating it. The easiest thing would be to just add it to a Python list, so you can iterate over all created GtkEntry widgets later.
Or, you could "tag" the widgets with something to make them identifiable, and iterate over the containing widgets (assuming you really do add the widget to a window or something).