Skip to content

Latest commit

 

History

History
145 lines (92 loc) · 3.73 KB

dbpp.widgets.xtableview.md

File metadata and controls

145 lines (92 loc) · 3.73 KB

dbpp.widgets package: GuiBaseClass - AutoScrollbar - Balloon - Ctext - LabEntry - RoText - Scrolled - SqlText - StatusBar - TableView - TextMixins - XTableView - XTreeView

dbpp.kroki - dbpp.kroki.KrokiEncoder - dbpp.utils - dbpp.utils.SqlUtils -

apps: dbpp.peditor

module widgets.xtableview

Extension of the TableView widget which can as well insert lists into the ttk.Treeview widget.

The widget TableView provides an extension for the TableView table widget with a readData function, getting header and lists inheriting all methods and options from TableView.

Hint: This functionality should be better implemented as a Mixin.

Below you see the inheritance hierarchy and the added methods:

@startuml
class "ttk.TreeView" as Treeview {
     configure(kwargs)
     cget("property")
     etc()
}
class "dbpp.widgets.TableView" as TableView {
     readTabfile(filename)
     pack(kwargs)
     pack_forget()
}
class "dbpp.widgets.XTableView" as XTableView {
     insert_data(colnames,data)
}
Treeview <- TableView
TableView <- XTableView
@enduml

Examples:

import tkinter as tk
import tkinter.ttk as ttk
from dbpp.widgets.XTableView import XTableView 
root = tk.Tk()
root.title('XTableView Demo')
dgtab=XTableView(root)
dgtab.getFrame().pack(side='top',fill='both',expand=True)
dgtab.insert_data(['Col1','Col2'],
     data=[['val1.1','val1.2'], ['val2.1','val2.2']])
root.geometry("400x300")
root.mainloop()

Author: Detlef Groth, University of Potsdam, 2019-2023

License: MIT - License


class XTableView

Extended ttk.Treeview based on TableView.

method __init__

__init__(parent, *args, **kwargs)

The constructor to create a XTableView widget.

Args:

  • parent (ttk.Frame): the parent widget wherein the ttk.Treeview widget will be placed.
  • *args (list): standard ttk.Treeview arguments which will be delegated to the widget
  • **kwargs (dict): standard ttk.Treeview arguments which will be delegated to the widget

Returns: XTableView widget with addtional methods and all methods of a ttk.Treeview widget


method insert_data

insert_data(colnames='', data='')

Inserts data into a ttk.Treeview widget.

Args:

  • colnames (list): list of column nanes
  • data (list): nested list of data

This file was automatically generated via lazydocs.