Skip to content

[ Enhancement] Add table wrap #5823

@yutianlong

Description

@yutianlong

###Enhancement

Operating System

windows 10

PySimpleGUI Port (tkinter, Qt, Wx, Web)

default


Versions

Python version (sg.sys.version)

python 3.10

PySimpleGUI Version (sg.__version__)

4.60.3

GUI Version (tkinter (sg.tclversion_detailed), PySide2, WxPython, Remi)

default


Your Experience In Months or Years (optional)

Years Python programming experience
7 years
Years Programming experience overall

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

Anything else you think would be helpful?


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 want to create a table that can display the full content
then I can not find can be wrap in table
so, when I have a long content in a cell, we only Elongate a cell or Manually change content.
Can you add a wrap function to the table?

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:

def get_data(filename):
    df_sheet_data = pd.read_excel(io=filename, sheet_name=0, index_col=0)
    df_sheet_data = df_sheet_data.fillna(' ', inplace=False)[df_sheet_data.columns[0:6]]

    list_sheet_header = df_sheet_data.columns.tolist()
    list_sheet_data = df_sheet_data.values.tolist()
    return list_sheet_header, list_sheet_data


header, data = get_data(r'D:\tsing\511\511_V1.2.1_case_0823.xlsx')
layout_table = [
    [sg.Table(values=data,
              headings=header,
              col_widths=[11, 13, 18, 10, 19, 8],
              row_height=50,
              display_row_numbers=False,
              auto_size_columns=False,
              num_rows=min(15, len(data)))]
]

Screenshot, Sketch, or Drawing

image


Watcha Makin?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Port - TKPySimpleGUIQuestionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions