python / python/cpython

ttk.tkinter.Notebook does not refresh notebook page on Mac unless mouse moves out of tab area

未关闭
#136,095 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

OS-mac stdlib topic-tkinter type-bug
主要语言
Python
星标
77.2k
派生
36k
PR 合并指标
PR 指标待抓取

描述

Bug report

Bug description:

Test Code:

from tkinter import *
from tkinter.ttk import Notebook

mw = Tk()
mw.title("Notebook Test")
mw.geometry(f"{800}x{800}")

main_page_frame = Frame(mw, borderwidth=1, relief='ridge')
main_page_frame.pack(side='top', expand=1, fill='both')

notebook = Notebook(main_page_frame)
notebook.pack(expand=1, fill='both')

for info in ("one", "two", "three"):
    frame = Frame(mw)
    Label(frame, text=info).pack()
    notebook.add(frame, text=info)

mw.mainloop()

Test Computer

MacOS Sequoia: Version 15.3.1

Problem

prepare

Click on the three tabs, one after another. The behaviour is what one would expect

execution

  • carefully click on a new tab... but don't move the mouse once you have clicked

problem

  • the notebook page does not refresh (i.e. you won't see the label within the notebook)
  • if you move the mouse carefully just within the tab name area, nothing happens
  • if you move the mouse outside of this area, the label will suddenly appear.

Note

Tried this on a windows machine, and the behaviour as it should be, so this problem seems to be a MAC problem (don't have a linux machine so can't try there).

According to the documentation, the MAC python 3.13 has its own version of Tcl/Tk, so maybe this is a Tcl/Tk problem, and not a python problem?

CPython versions tested on:

3.13

Operating systems tested on:

macOS

贡献指南

打开贡献指南

从这里开始

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

调研方向

首先,在 macOS Sequoia 上使用 Python 3.13 运行随附的 Notebook 示例,并将点击选项卡时的行为与 Windows 进行比较。阅读 tkinter Notebook 的实现,以及报告中提到的 macOS Tcl/Tk 行为。完成标准是:选择选项卡后,其页面会立即显示,无需将鼠标移出选项卡区域。

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

评估

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

把新 issue 发到你的邮箱

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