cengal.user_interface.gui.tkinter.components.read_only_text.versions.v_0.read_only_text
1#!/usr/bin/env python 2# coding=utf-8 3 4# Copyright © 2012-2024 ButenkoMS. All rights reserved. Contacts: <gtalk@butenkoms.space> 5# 6# Licensed under the Apache License, Version 2.0 (the "License"); 7# you may not use this file except in compliance with the License. 8# You may obtain a copy of the License at 9# 10# http://www.apache.org/licenses/LICENSE-2.0 11# 12# Unless required by applicable law or agreed to in writing, software 13# distributed under the License is distributed on an "AS IS" BASIS, 14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15# See the License for the specific language governing permissions and 16# limitations under the License. 17 18 19__all__ = ['ReadOnlyText'] 20 21 22""" 23Module Docstring 24Docstrings: http://www.python.org/dev/peps/pep-0257/ 25""" 26 27__author__ = "ButenkoMS <gtalk@butenkoms.space>" 28__copyright__ = "Copyright © 2012-2024 ButenkoMS. All rights reserved. Contacts: <gtalk@butenkoms.space>" 29__credits__ = ["ButenkoMS <gtalk@butenkoms.space>", ] 30__license__ = "Apache License, Version 2.0" 31__version__ = "4.4.1" 32__maintainer__ = "ButenkoMS <gtalk@butenkoms.space>" 33__email__ = "gtalk@butenkoms.space" 34# __status__ = "Prototype" 35__status__ = "Development" 36# __status__ = "Production" 37 38 39from ttkbootstrap.scrolled import ScrolledText as TtkbScrolledText 40from idlelib.redirector import WidgetRedirector 41 42 43class ReadOnlyText(TtkbScrolledText): 44 def __init__(self, *args, **kwargs): 45 super().__init__(*args, **kwargs) 46 self.redirector = WidgetRedirector(self) 47 self.insert = self.redirector.register("insert", lambda *args, **kw: "break") 48 self.delete = self.redirector.register("delete", lambda *args, **kw: "break")
class
ReadOnlyText(ttkbootstrap.scrolled.ScrolledText):
44class ReadOnlyText(TtkbScrolledText): 45 def __init__(self, *args, **kwargs): 46 super().__init__(*args, **kwargs) 47 self.redirector = WidgetRedirector(self) 48 self.insert = self.redirector.register("insert", lambda *args, **kw: "break") 49 self.delete = self.redirector.register("delete", lambda *args, **kw: "break")
A text widget with optional vertical and horizontal scrollbars.
Setting autohide=True
will cause the scrollbars to hide when the
mouse is not over the widget. The vertical scrollbar is on by
default, but can be turned off. The horizontal scrollbar can be
enabled by setting vbar=True
.
This widget is identical in configuration to the Text
widget other
than the scrolling frame. https://tcl.tk/man/tcl8.6/TkCmd/text.htm
Examples:
import ttkbootstrap as ttk
from ttkbootstrap.constants import *
from ttkbootstrap.scrolled import ScrolledText
app = ttk.Window()
# scrolled text with autohide vertical scrollbar
st = ScrolledText(app, padding=5, height=10, autohide=True)
st.pack(fill=BOTH, expand=YES)
# add text
st.insert(END, 'Insert your text here.')
app.mainloop()
ReadOnlyText(*args, **kwargs)
45 def __init__(self, *args, **kwargs): 46 super().__init__(*args, **kwargs) 47 self.redirector = WidgetRedirector(self) 48 self.insert = self.redirector.register("insert", lambda *args, **kw: "break") 49 self.delete = self.redirector.register("delete", lambda *args, **kw: "break")
Parameters:
master (Widget):
The parent widget.
padding (int):
The amount of empty space to create on the outside of
the widget.
bootstyle (str):
A style keyword used to set the color and style of the
vertical scrollbar. Available options include -> primary,
secondary, success, info, warning, danger, dark, light.
vbar (bool):
A vertical scrollbar is shown when **True** (default).
hbar (bool):
A horizontal scrollbar is shown when **True**. Turning
on this scrollbar will also set `wrap="none"`. This
scrollbar is _off_ by default.
autohide (bool):
When **True**, the scrollbars will hide when the mouse
is not within the frame bbox.
**kwargs (Dict[str, Any]):
Other keyword arguments passed to the `Text` widget.
Inherited Members
- ttkbootstrap.scrolled.ScrolledText
- text
- hbar
- vbar
- hide_scrollbars
- show_scrollbars
- autohide_scrollbar
- tkinter.ttk.Widget
- identify
- instate
- state
- tkinter.BaseWidget
- widgetName
- destroy
- tkinter.Misc
- deletecommand
- tk_strictMotif
- tk_bisque
- tk_setPalette
- wait_variable
- waitvar
- wait_window
- wait_visibility
- setvar
- getvar
- getint
- getdouble
- getboolean
- focus_set
- focus
- focus_force
- focus_get
- focus_displayof
- focus_lastfor
- tk_focusFollowsMouse
- tk_focusNext
- tk_focusPrev
- after
- after_idle
- after_cancel
- bell
- clipboard_get
- clipboard_clear
- clipboard_append
- grab_current
- grab_release
- grab_set
- grab_set_global
- grab_status
- option_add
- option_clear
- option_get
- option_readfile
- selection_clear
- selection_get
- selection_handle
- selection_own
- selection_own_get
- send
- lower
- tkraise
- lift
- winfo_atom
- winfo_atomname
- winfo_cells
- winfo_children
- winfo_class
- winfo_colormapfull
- winfo_containing
- winfo_depth
- winfo_exists
- winfo_fpixels
- winfo_geometry
- winfo_height
- winfo_id
- winfo_interps
- winfo_ismapped
- winfo_manager
- winfo_name
- winfo_parent
- winfo_pathname
- winfo_pixels
- winfo_pointerx
- winfo_pointerxy
- winfo_pointery
- winfo_reqheight
- winfo_reqwidth
- winfo_rgb
- winfo_rootx
- winfo_rooty
- winfo_screen
- winfo_screencells
- winfo_screendepth
- winfo_screenheight
- winfo_screenmmheight
- winfo_screenmmwidth
- winfo_screenvisual
- winfo_screenwidth
- winfo_server
- winfo_toplevel
- winfo_viewable
- winfo_visual
- winfo_visualid
- winfo_visualsavailable
- winfo_vrootheight
- winfo_vrootwidth
- winfo_vrootx
- winfo_vrooty
- winfo_width
- winfo_x
- winfo_y
- update
- update_idletasks
- bind
- unbind
- bind_all
- unbind_all
- bind_class
- unbind_class
- mainloop
- quit
- nametowidget
- register
- cget
- keys
- pack_propagate
- propagate
- pack_slaves
- slaves
- place_slaves
- grid_anchor
- anchor
- grid_bbox
- bbox
- grid_columnconfigure
- columnconfigure
- grid_location
- grid_propagate
- grid_rowconfigure
- rowconfigure
- grid_size
- size
- grid_slaves
- event_add
- event_delete
- event_generate
- event_info
- image_names
- image_types
- tkinter.ttk.Frame
- configure
- config
- tkinter.Pack
- pack_configure
- pack_forget
- forget
- pack_info
- info
- pack
- tkinter.Place
- place_configure
- place_forget
- place_info
- place
- tkinter.Grid
- grid_configure
- grid_forget
- grid_remove
- grid_info
- grid
- location