Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Bug Found from PySimpleGUI spin element

未关闭
#41 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
55/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
python
领域
desktop

调研方向

Start in the main init.py file at the Spin element's ChangeSubmits handling, then inspect _SpinboxSelectHandler and _SpinChangedHandler. Reproduce the issue by holding a spin arrow and releasing it; done means the final value is captured and the corresponding event is fired without another click.

由索引模型根据 Issue 内容生成。

描述

Windows 10
FreeSimpleGUI / PySimpleGUI

The issue is with the sg.Spin element when holding down either up or down arrows buttons continuously.
When you release the mouse button or , the final value would of not been captured internally unless i suppose you do an additional write_event_value or whatever.

sg.Spin(
    values=[i for i in range(21)], 
    size=(2, 1), 
    font="Arial 9", 
    background_color=bgc, 
    enable_events=True, 
    readonly=True, 
    k="Lockout", 
    p=((8, 0), (30, 0))
)

in my code im busy with i cannot click additional time to get the final value using element.get()

So here if i start the default value as 5 and then hold down mouse button on the up arrow button in the spinbox.
When it reaches 20 and i let go the mouse button, i dont get the value 20 from call element.get() and infact while holding down the mouse button there are no more events fired for the spinbox.

They guys from PySimpleGUI actually had the correct code but then messed it up.

In the main __init__.py file find under element spin

if element.ChangeSubmits:
    element.TKSpinBox.configure(command=element._SpinboxSelectHandler)   -----   This needs to be commented out
    # element.TKSpinBox.bind('<ButtonRelease-1>', element._SpinChangedHandler) --- enable this again but use _SpinboxSelectHandler
    # element.TKSpinBox.bind('<Up>', element._SpinChangedHandler) --- leave as is
    # element.TKSpinBox.bind('<Down>', element._SpinChangedHandler) ---- leave as is

For me doing this fixed the spinbox.

Also this internal method _SpinChangedHandler from the class Spin is pointless at the moment as it does not get called anywhere because they changed to using _SpinboxSelectHandler.

主要语言
Python
星标
867
派生
106
平均合并
1 分钟
30 天内合并 PR
2

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

spyoungtech/FreeSimpleGUI 的其他 Issue

查看 spyoungtech/FreeSimpleGUI 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。