Tkinter - Treeview Edit Cells Directly

JobinPy
JobinPy
19.9 هزار بار بازدید - 2 سال پیش - I'll show you how to
I'll show you how to edit individual cells in the Treeview widget.

You will be able to double-click a cell and edit the value directly.

This involves placing an entry widget over top of a Treeview cell at the right time, which then allows the user to edit the text.

The treeview widget provides the methods we need to make this happen.

A reference site which lists some of the methods we will be using in the Treeview widget:
http://tkdocs.com/shipman/ttk-Treevie...

0:00 Intro
0:57 Demo app
1:18 Starter code
2:00 Create a treeview class
4:35 Create columns
5:19 Add text to heading
6:42 Insert rows
9:28 Bind to double-click
12:03 Identify region double-clicked
16:43 Identify which item was double-clicked
20:16 Difference between text and values
21:57 Get selected text or values
23:50 Get cell text
27:04 Get cell bounding box
30:43 Create entry widget
35:02 Demo app with entry widget
35:38 Entry focus out binding
37:49 Update treeview data
44:21 Final demo app
45:16 Closure

#tkinter #treeview #pythongui #python3
2 سال پیش در تاریخ 1401/04/08 منتشر شده است.
19,998 بـار بازدید شده
... بیشتر