Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ Enhancement] Add tab_size option to Multiline Element #6198

Closed
8 tasks
casmithac opened this issue Jan 31, 2023 · 2 comments
Closed
8 tasks

[ Enhancement] Add tab_size option to Multiline Element #6198

casmithac opened this issue Jan 31, 2023 · 2 comments
Labels
Port - TK PySimpleGUI

Comments

@casmithac
Copy link

Type of Issue (Enhancement, Error, Bug, Question)

Enhancement


Operating System

Windows 11

PySimpleGUI Port (tkinter, Qt, Wx, Web)

tkinter


Versions

Python version: 3.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:52:53) [MSC v.1927 64 bit (AMD64)]
port: tkinter
tkinter version: 8.6.9
PySimpleGUI version: 4.60.4
PySimpleGUI filename: C:\Python\Python386\lib\site-packages\PySimpleGUI\PySimpleGUI.py
4.60.4 Released 10-Oct-2022
3.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:52:53) [MSC v.1927 64 bit (AMD64)]
8.6.9


Your Experience In Months or Years (optional)

Years Python programming experience
4 years

Years Programming experience overall
53 ... started in 1970

Have used another Python GUI Framework? (tkinter, Qt, etc) (yes/no is fine)
yes


Troubleshooting

These items may solve your problem. Please check those you've done by changing - [ ] to - [X]

  • Searched main docs for your problem www.PySimpleGUI.org
  • Looked for Demo Programs that are similar to your goal. It is recommend you use the Demo Browser! Demos.PySimpleGUI.org
  • If not tkinter - looked for Demo Programs for specific port
  • For non tkinter - Looked at readme for your specific port if not PySimpleGUI (Qt, WX, Remi)
  • Run your program outside of your debugger (from a command line)
  • Searched through Issues (open and closed) to see if already reported Issues.PySimpleGUI.org
  • Have upgraded to the latest release of PySimpleGUI on PyPI (lastest official version)
  • Tried using the PySimpleGUI.py file on GitHub. Your problem may have already been fixed but not released

Detailed Description

I'm sending a document to a Multiline Element that has embedded tabs(\t). The original doc shows these as four spaces. The Multiline Element shows these as eight spaces. I'd like to see an option to choose the tab_size i.e. tab_size=4.

Code To Duplicate

A short program that isolates and demonstrates the problem (Do not paste your massive program, but instead 10-20 lines that clearly show the problem)

This pre-formatted code block is all set for you to paste in your bit of code:

sg.Multiline(size=(40, 14), key="-BEFORE-")

window["-BEFORE-"].update(r.get_before())

Screenshot, Sketch, or Drawing

Screenshot 2023-01-31 070336


Watcha Makin?

If you care to share something about your project, it would be awesome to hear what you're building.

@PySimpleGUI
Copy link
Owner

Wow! I forgot about those other answers entirely. If this is a duplicate, I'll take the blame for it as I send @casmithac here to open a request.

I was experimenting with an oversimplified attempt at setting tabs to be 4 spaces but didn't have very good luck.

# in the layout
        [sg.Multiline(key='-ML-', s=(60,10), )],

# later...
        window['-ML-'].widget.config(tabs=sg.Text.char_width_in_pixels(window['-ML-'].widget['font'], ' ')*4)

It's not as easy as I would have hoped it would be. It would be a nice parameter to add to Multiline for inputs. I definitely see where it would be useful to have 4 char tabs for a text editor application for example.

@casmithac - WOW you've got SOOOOOOOOOOOOO much experience in this craft. Love it image
that you're using PySimpleGUI! Thanks for taking the time to fill out the request.

@jason990420 jason990420 added the Port - TK PySimpleGUI label Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Port - TK PySimpleGUI
Projects
None yet
Development

No branches or pull requests

3 participants