Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[Bug] vertical Slider flips range when updating

Aperta
#6,310 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
python
Ambito
desktop

Direzione di ricerca

Inizia con il metodo di aggiornamento di Slider ed esegui il riproduttore Python dell’issue usando il port tkinter. Controlla gli slider orizzontali e verticali durante l’aggiornamento di range=(0,5), quindi verifica che l’orientamento orizzontale conservi l’intervallo e che l’orientamento verticale conservi la direzione dall’alto verso il basso. Il lavoro è completato quando entrambi gli orientamenti mantengono l’intervallo visualizzato previsto dopo l’aggiornamento.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Bug Port - TK

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

Bug


Environment

Operating System

Windows version ('10', '10.0.19045', 'SP0', 'Multiprocessor Free')

PySimpleGUI Port (tkinter, Qt, Wx, Web)

tkinter


Versions

Python version (sg.sys.version)

3.11.2 (tags/v3.11.2:878ead1, Feb 7 2023, 16:38:35) [MSC v.1934 64 bit (AMD64)]

PySimpleGUI Version (sg.__version__)

4.61.0.166

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

8.6.12


Your Experience In Months or Years (optional)

.5 Years Python programming experience
8 Years Programming experience overall
Yes Have used another Python GUI Framework? (tkinter, Qt, etc) (yes/no is fine)


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
  • Upgraded to the latest official release of PySimpleGUI on PyPI
  • Tried using the PySimpleGUI.py file on GitHub. Your problem may have already been fixed but not released

Detailed Description

If updating the range of a vertical a slider, its range is flipped vertically. E.g. Slider(range = (0,5)) means 5 is top and 0 is bottom, update(range=(0,5)) means 5 is bottom, 0 is top.

Fix (works for me): In the update method for the Slider

if range != (None, None):
	self.TKScale.config(from_=range[0], to_=range[1])

needs to be changed to

if range != (None, None):
   if self.Orientation.startswith('h'):
      self.TKScale.config(from_=range[0], to_=range[1])
   else:
      self.TKScale.config(from_=range[1], to_=range[0])
Code To Duplicate
import PySimpleGUI as sg

sliderh = sg.Slider(range=(0,5), key = 'slider', orientation = 'h')
sliderv = sg.Slider(range=(0,5), key = 'slider', orientation = 'v')
button = sg.Button(button_text='Update', key = 'button')
window = sg.Window(title = 'test', layout = [[sliderh, sliderv], [button]], finalize = True)

while True:
	event, _ = window.read()
	
	if event in [None, 'Exit', 'Close']:
		break
	
	if event == 'button':
		sliderv.update(range = (0,5))
		sliderh.update(range = (0,5))

window.close()
Lingua principale
Python
Stelle
13.8k
Fork
1.8k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di PySimpleGUI/PySimpleGUI

Tutte le issue di PySimpleGUI/PySimpleGUI

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.