twisted / twisted/twisted

Feature request: can we specify a specific TclTk event loop to pass to ```twisted.internet.tksupport.install``` ?

Open
#12,100 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
6k
Forks
1.2k
Avg merge
2d 10h
Merged PRs (30d)
10

Description

Is your feature request related to a problem? Please describe.
The tksupport.install method calls widget.update(). The Tcl_UpdateObjCmd function, i.e. the update command in Tcl or Python's widget.update() is known to cause problems in complex TclTk applications and its use is generally ill-advised.

Describe the solution you'd like
Can we pass any tkinter event loop to tksupport.install, instead of it needing to use update? For example, it'd be nice to make a call as follows:

widget = tkinter.Tk()
twisted.internet.tksupport.install( widget.tk.dooneevent, ms=ms )

Or, for example, for even more control over the types of events we'd like to process, or to control how the loop behaves:

twisted.internet.tksupport.install( widget.tk.dooneevent, tkinter._tkinter.FILE_EVENTS | tkinter._tkinter.DONT_WAIT, ms=ms)

With any of the flags or'ed together.

Or if update is preferred, widget.update can be passed directly.

Describe alternatives you've considered
the Tcl update command doesn't appear to accept the TCL_DONT_WAIT flag, which can cause the application to get stuck in the Tcl_UpdateObjCmd loop. In addition, it doesn't afford us any control over the types of events update will process, except for when we use the idletasks option.

Additional context
My reason for asking is that my Twisted application seems to hang the TCL_UpdateObjCmd event loop when update is called, leading to a nested-eventloop condition that TclTk is unable to break out of. The application hangs with no hope of recovering it.

Thanks for your consideration.

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 twisted.internet.tksupport.install and trace its use of widget.update(), then compare the requested doonevent callback and event flags with the current integration. Done means the event-loop behavior and API scope are defined without the reported nested-loop hang; the issue names no test path.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
desktop
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 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.