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
Read only text widget.
This is a text widget derived from the tk.Text widget where the user can't change the text. The widget otherwise has all the methods. of the original text widget. To insert text programmatically use the syntax cmd('ins',index, text)
, to delete the text use the cmd('del',start,end)
syntax.
Examples:
>>> import tkinter as tk
>>> import dbpp.widgets.rotext as rotext
>>> root= tk.Tk()
>>> rtext = rotext.RoText(root)
>>> rtext.cmd("ins","end","Hello World!")
>>> root.title('RoTtext example')
''
>>> rtext.pack(fill="both",expand=True)
Author:
- 2023 Detlef Groth
License: MIT - License
Readonly text widget based on tkText.
This is an wrapper for a read only text widget, based on the dgw::rotext widget. There is only one public method, cmd
which forwards the remaining arguments to the original text widget. The widget methods insert and delete are doing nothing. To insert text you should use the cmd
method instead.
__init__(master=None, cnf={}, **kwargs)
Initialize the RoText widget.
Args:
master
(ttk.Frame): the parent widget, usually a ttk.Frame, if not given the toplevel is choosen, default: Nonecnf, **kwargs (dict)
: options delegated to the underlying tk.Text widget
cmd(cmd, *args, **kwargs)
Access the original methods of the tk.Text widget.
This is the method to access all original methods of the tk.Text widget except for the insert
and delete
method which are disabled. Instead of these methods you should use w.cmd('ins', ...)
and `w.cmd('del', ...) to insert and to delete data.
Args:
cmd
(str): as the widget commands insert and delete are disabled you usecmd('ins',index, txt)
andcmd('del',start,end) instead to insert and delete text
**args (list)
: additional positional arguments delegated to the given command*kwargs (dict)
: additional key-value arguments delegated to the given command
Example:
>>> import tkinter as tk
>>> root= tk.Tk()
>>> rtext = RoText(root)
>>> rtext.cmd("ins","end","Hello World!")
>>> rtext.get("1.0","end-1c")
'Hello World!'
>>> rtext.pack(fill="both",expand=True)
This file was automatically generated via lazydocs.