PySimpleGUI / PySimpleGUI/PySimpleGUI

Documentation: Slider() size parameter sizes height in pixels, not in rows

Open
#4,250 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation
Dominant language
Python
Stars
13.8k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

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

Bug


Operating System

Ubuntu 21.04

PySimpleGUI Port (tkinter, Qt, Wx, Web)

tkinter


Versions

Version information can be obtained by calling sg.main_get_debug_data()
Or you can print each version shown in ()

Python version (sg.sys.version)

3.8.5 (default, Jan 27 2021, 15:41:15)

PySimpleGUI Version (sg.__version__)

4.40.0

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

tkinter


Your Experience In Months or Years (optional)

Years Python programming experience
~2
Years Programming experience overall
20+
Have used another Python GUI Framework? (tkinter, Qt, etc) (yes/no is fine)
yes
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 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
  • Tried using the PySimpleGUI.py file on GitHub. Your problem may have already been fixed but not released
Detailed Description

When passing the size=() parameter to sg.Slider. the height is supposed to be specified in rows. However, it appears to be in pixels.

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:

import PySimpleGUI as sg

layout=[
    [sg.Slider(key='slider1', orientation='h')], # default works fine
    [sg.Slider(key='slider2', orientation='h', size=(30,1))], # height should be 1 row, but sizes in pixels
    [sg.Slider(key='slider3', orientation='h', size=(30,5))], # height should be 5 row, but sizes in pixels
    [sg.Slider(key='slider4', orientation='h', size=(30,18))] # 18 pixels looks more normal
]

win=sg.Window('Slider bug demo', layout, finalize=True)

while True:
    event, values = win.read()
    if event == sg.WIN_CLOSED or event == 'Exit':
        break
Screenshot, Sketch, or Drawing

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the sg.Slider entry point and reproduce the reported layout with the four slider sizes in the issue body on the tkinter port. Confirm that the size height is interpreted in rows, including size=(30,1), and use the demonstrated behavior as the completion check.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.