Skip to content

protect against Tk not having _default_root attr during event loop #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Manifest.toml
.CondaPkg
15 changes: 9 additions & 6 deletions src/pygui.jl
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,15 @@ function Tk_eventloop(sec::Real=50e-3)
flag = _tkinter.ALL_EVENTS | _tkinter.DONT_WAIT
root = pynothing = Py(nothing)
install_doevent(sec) do async
new_root = Tk._default_root
if pyconvert(Bool, new_root != pynothing)
root = new_root
end
if pyconvert(Bool, root != pynothing)
while pyconvert(Bool, root.dooneevent(flag))
@show typeof(Tk)
if pyhasattr(Tk, "_default_root")
new_root = Tk._default_root
if pyconvert(Bool, new_root != pynothing)
root = new_root
end
if pyconvert(Bool, root != pynothing)
while pyconvert(Bool, root.dooneevent(flag))
end
end
end
end
Expand Down