diff --git a/demo/showcase/textpicker.py b/demo/showcase/textpicker.py new file mode 100755 index 00000000..fa0cbd91 --- /dev/null +++ b/demo/showcase/textpicker.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python3 + +# MIT License +# +# Copyright (c) 2023 Eugenio Parodi +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +import sys, os, argparse, math, random + +sys.path.append(os.path.join(sys.path[0],'../..')) +import TermTk as ttk + +def demoTextPicker(root=None): + frame = ttk.TTkFrame(parent=root, border=False) + + ttk.TTkLabel(parent=frame, pos=(0,0),text="No Autosize") + ttk.TTkTextPicker(parent=frame, pos=( 0,1), size=(20, 1),autoSize=False, multiLine=False) + ttk.TTkLabel(parent=frame, pos=(0,2),text="Multiline") + ttk.TTkTextPicker(parent=frame, pos=( 0,3), size=(20, 1),autoSize=False, multiLine=True) + ttk.TTkLabel(parent=frame, pos=(0,4),text="Autosize") + ttk.TTkTextPicker(parent=frame, pos=( 0,5), size=(20, 1),autoSize=True, multiLine=True) + + ttk.TTkTextPicker(parent=frame, pos=(25,0), size=(20, 5),autoSize=True, multiLine=True) + ttk.TTkTextPicker(parent=frame, pos=(50,0), size=(20,10),autoSize=True, multiLine=True) + + return frame + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('-f', help='Full Screen', action='store_true') + args = parser.parse_args() + + ttk.TTkTheme.loadTheme(ttk.TTkTheme.NERD) + + root = ttk.TTk() + if args.f: + root.setLayout(ttk.TTkGridLayout()) + winColor1 = root + else: + winColor1 = ttk.TTkWindow(parent=root,pos = (0,0), size=(58,20), title="Test Text Picker", border=True, layout=ttk.TTkGridLayout()) + + demoTextPicker(winColor1) + + winKP = ttk.TTkWindow(parent=root,pos = (5,25), size=(85,7), title="Captured Input") + winKP.setLayout(ttk.TTkHBoxLayout()) + ttk.TTkKeyPressView(parent=winKP) + + root.mainloop() + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/docs/source/info/features/widgets.rst b/docs/source/info/features/widgets.rst index 37de8c0d..bb57a5cb 100644 --- a/docs/source/info/features/widgets.rst +++ b/docs/source/info/features/widgets.rst @@ -10,111 +10,50 @@ Base Widgets .. image:: https://github.com/ceccopierangiolieugenio/pyTermTk/assets/8876552/f930f010-79ce-4b9a-8b2b-796af6d1542c +* Label :class:`~TermTk.TTkWidgets.label.TTkLabel` +* Button :class:`~TermTk.TTkWidgets.button.TTkButton` +* ComboBox :class:`~TermTk.TTkWidgets.combobox.TTkCombobox` +* Line Edit :class:`~TermTk.TTkWidgets.lineedit.TTkLineedit` +* Spinbox :class:`~TermTk.TTkWidgets.spinbox.TTkSpinbox` +* Checkbox :class:`~TermTk.TTkWidgets.checkbox.TTkCheckbox` +* Radio Button :class:`~TermTk.TTkWidgets.radiobutton.TTkRadiobutton` +* Scrollbar :class:`~TermTk.TTkWidgets.scrollbar.TTkScrollBar` -Label -~~~~~ -:class:`~TermTk.TTkWidgets.label.TTkLabel` +* List :class:`~TermTk.TTkWidgets.list_.TTkList` +* Menu :class:`~TermTk.TTkWidgets.menu.TTkMenu` +* Tab :class:`~TermTk.TTkWidgets.tabwidget.TTkTabWidget` -Button -~~~~~~ -:class:`~TermTk.TTkWidgets.button.TTkButton` - -ComboBox -~~~~~~~~ -:class:`~TermTk.TTkWidgets.combobox.TTkCombobox` - -Line Edit -~~~~~~~~ -:class:`~TermTk.TTkWidgets.lineedit.TTkLineedit` - -Spinbox -~~~~~~~ -:class:`~TermTk.TTkWidgets.spinbox.TTkSpinbox` - -Checkbox -~~~~~~~~ -:class:`~TermTk.TTkWidgets.checkbox.TTkCheckbox` - -Radio Button -~~~~~~~~~~~~ -:class:`~TermTk.TTkWidgets.radiobutton.TTkRadiobutton` - - - -List -~~~~ -:class:`~TermTk.TTkWidgets.list_.TTkList` - -Menu -~~~~ -:class:`~TermTk.TTkWidgets.menu.TTkMenu` - - - -Scrollbar -~~~~~~~~~ -:class:`~TermTk.TTkWidgets.scrollbar.TTkScrollBar` - -Tab -~~~ -:class:`~TermTk.TTkWidgets.tabwidget.TTkTabWidget` - -Window -~~~~~~ -:class:`~TermTk.TTkWidgets.window.TTkWindow` Specialised Widgets ------------------- -TextEdit -~~~~~~~~ -:class:`~TermTk.TTkWidgets.texedit.TTkTextEdit` - -KodeTab -~~~~~~~ +.. image:: https://github.com/ceccopierangiolieugenio/pyTermTk/assets/8876552/ebc52793-484d-4fee-9ccd-8d8cc2e810fe +* TextEdit :class:`~TermTk.TTkWidgets.texedit.TTkTextEdit` -Terminal -~~~~~~~~ +.. image:: https://github.com/ceccopierangiolieugenio/pyTermTk/assets/8876552/3f4f7306-fb6c-4892-8960-3d42780a34de +* KodeTab :class:`~TermTk.TTkWidgets.kodetb.TTkKodeTab` +* Terminal TBD .. _widgets-pickers: Pickers ------- +.. image:: https://github.com/ceccopierangiolieugenio/pyTermTk/assets/8876552/35de8317-1ee6-4dad-9c46-320d0692c393 +* Text Picker -Text Picker -~~~~~~~~~~~ - -File Picker -~~~~~~~~~~~ - -Color Picker -~~~~~~~~~~~~ - - -Specialised Widgets -------------------- - -TextEdit -~~~~~~~~ - -KodeTab -~~~~~~~ - -Terminal -~~~~~~~~ +.. image:: https://github.com/ceccopierangiolieugenio/pyTermTk/assets/8876552/0388f4a0-1a93-4d57-9a77-c7e43422fedb +* File Picker +.. image:: https://github.com/ceccopierangiolieugenio/pyTermTk/assets/8876552/9a61baf3-f151-49a6-bde0-ace02eb9008e +* Color Picker .. _widgets-layout: Layout ------ -Frame -~~~~~ - -Resizable Frame -~~~~~~~~~~~~~~~ - -Splitter -~~~~~~~~ \ No newline at end of file +* Frame +* Resizable Frame +* Window :class:`~TermTk.TTkWidgets.window.TTkWindow` +* Splitter \ No newline at end of file diff --git a/docs/source/info/installing.rst b/docs/source/info/installing.rst index 6f02f043..9420b6da 100644 --- a/docs/source/info/installing.rst +++ b/docs/source/info/installing.rst @@ -88,9 +88,9 @@ Clone or `Download `_ (`tryItOnline `_) -* paint demo `paint.py `_ (`tryItOnline `_) -* ttkode prototype `ttkode.py `_ (`tryItOnline `_) +* Main demo `demo.py `_ (`tryItOnline `_) +* paint demo `paint.py `_ (`tryItOnline `_) +* ttkode prototype `ttkode.py `_ (`tryItOnline `_) .. code:: bash @@ -109,17 +109,17 @@ Showcase **Highlight:** -* Text Editor `textedit.py `_ (`tryItOnline `_) -* Animation `animation.01.py `_ (`tryItOnline `_) -* color picker `colorpicker.py `_ (`tryItOnline `_) -* file picker `filepicker.py `_ (`tryItOnline `_) -* drag & drop `dragndrop.py `_ (`tryItOnline `_) -* d&d with tabs `dndtabs.py `_ (`tryItOnline `_) -* d&d with list `list.py `_ (`tryItOnline `_) -* base widgets `formwidgets02.py `_ (`tryItOnline `_) -* messagebox `messagebox.py `_ (`tryItOnline `_) -* splitter `splitter.py `_ (`tryItOnline `_) -* Windows `windowsflags.py `_ (`tryItOnline `_) +* Text Editor `textedit.py `_ (`tryItOnline `_) +* Animation `animation.01.py `_ (`tryItOnline `_) +* color picker `colorpicker.py `_ (`tryItOnline `_) +* file picker `filepicker.py `_ (`tryItOnline `_) +* drag & drop `dragndrop.py `_ (`tryItOnline `_) +* d&d with tabs `dndtabs.py `_ (`tryItOnline `_) +* d&d with list `list.py `_ (`tryItOnline `_) +* base widgets `formwidgets02.py `_ (`tryItOnline `_) +* messagebox `messagebox.py `_ (`tryItOnline `_) +* splitter `splitter.py `_ (`tryItOnline `_) +* Windows `windowsflags.py `_ (`tryItOnline `_) * Tooltip `test.ui.026.toolTip.py `_ (`tryItOnline `_) .. code:: bash