Skip to content

Derive the sleep time from the Tk settings#220

Closed
glglgl-de wants to merge 1 commit into
insolor:mainfrom
glglgl-de:set-sleep-interval
Closed

Derive the sleep time from the Tk settings#220
glglgl-de wants to merge 1 commit into
insolor:mainfrom
glglgl-de:set-sleep-interval

Conversation

@glglgl-de

Copy link
Copy Markdown
Contributor

Hi, it's me again. I found another thing which might be worth improving.

The Tk main loop defines its sleep time via the parameter "getbusywaitinterval".

We could adjust our waiting time to that value (whose default is 20 ms and which can be configured) instead of using 10 ms as a fixed value.

The downside is that it uses an internal/"private" component, the C module _tkinter.

If you think that is reasonable anyway, feel free to accept this pull request (in this case maybe pull suggestion?), if you don't like messing around with Tk's internal belongings (_tkinter), that's fine as well. Maybe we could have an own setting for that interval (or we just let it as it is).

The Tk main loop defines its sleep time via the parameter "getbusywaitinterval".

Adjust our waiting time to that value.
@glglgl-de

Copy link
Copy Markdown
Contributor Author

Hm, it seems that it is a hard ruff requirement to not allow things like this. Then maybe it isn't viable and I close the PR.

@glglgl-de glglgl-de closed this Jun 17, 2026
@glglgl-de

Copy link
Copy Markdown
Contributor Author

I just saw that you use _tkinter directly as well, so I changed my code to do the same instead of tk._tkinter.

@insolor

insolor commented Jun 17, 2026

Copy link
Copy Markdown
Owner

The whole idea seems reasonable. You can just add # noqa: SLF001 comment to the interval_ms = tk._tkinter.getbusywaitinterval() line.

I don't care too much about this warning in this case.

@glglgl-de

Copy link
Copy Markdown
Contributor Author

That's fine. I created a 2nd PR (sorry for the mess) as I obviously was too stupid to use this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants