TreeView Basic Python - learnit

Home Top Ad

Post Top Ad

Friday, March 12, 2021

TreeView Basic Python

TreeView: Basic Python

Python Tkinter TreeView - How to Use

Python

Python is a general-purpose interpreted, interactive, object-oriented, and high-level programming language. It was created by Guido van Rossum during 1985- 1990. Like Perl, Python source code is also available under the GNU General Public License (GPL). This tutorial gives enough understanding on Python programming language.


Why to Learn Python?

Python is a high-level , interpreted, interactive and object-oriented scripting language. Python is designed to be highly readable. It uses English keywords frequently where as other languages use punctuation, and it has fewer syntactical constructions than other languages.


Python is a MUST for students and working professionals to become a great Software Engineer specially when they are working in Web Development Domain. I will list down some of the key advantages of learning Python

    Python is Interpreted − Python is processed at runtime by the interpreter. You do not need to compile your program before executing it. This is similar to PERL and PHP.


    Python is Interactive − You can actually sit at a Python prompt and interact with the interpreter directly to write your programs.


    Python is Object-Oriented − Python supports Object-Oriented style or technique of programming that encapsulates code within objects.


    Python is a Beginner's Language − Python is a great language for the beginner-level programmers and supports the development of a wide range of applications from simple text processing to WWW browsers to games.


In this Python tutorial , we will learn how to create Python Tkinter TreeView. Also, we will cover these topics:


1) What is Python Tkinter Treeview

2) How to use insert items in Python Tkinter Treeview


1)What is Python Tkinter Treeview

-Tkinter Treeview refers to hierarchical representation. When we have a relation between data in that case we have Treeview.

-Python Tkinter Treeview gives an improved look to the data columns

-Python Tkinter Treeview is derived from tkinter.ttk module

-There is always one extra column created while creating Treeview. We call that column as ‘ghost column’. Note this is just for our reference.


2)Python Tkinter TreeView Insert

method of tkinter.ttk.Treeview instance Creates a new item and returns the item identifier of the newly created item

Syntax

Insert(parent ,index,iid=None , **kw)

the parent is the item ID of the parent item, or the empty string to create a new top-level item.


the index is an integer or the value end, specifying wherein the list of parent’s children to insert the new item. If the index is less than or equal to zero, the new node is inserted at the beginning and if the index is greater than or equal to the current number of children, it is inserted at the end.


iid is used as the item identifier, iid must not already exist in the tree. Otherwise, a new unique identifier is generated.



Example

mytree.insert(parent='', index='end', iid=0, text="", values=(1, "Pov Dara", "Male"))
mytree.insert(parent='', index='end', iid=1, text="", values=(2, "Kong Nimol", "Female"))


Please Watching My Video


No comments:

Post a Comment

Post Top Ad