2

I am trying to add a messagebox yes no question after closing a open3d window.

code to reproduce the error:

open3d.visualization.draw_geometries([])
#create yes no
dialougdialog = messagebox.askquestion("Remove Object", "Remove Object?", icon='warning')

i cant find an answer online and chatgpt gives me a generic answer that I don't understand. if someone had this issue or similar i would be grateful to know how you handled this error.

Thank you in advance.

the error produce after clicking on "yes":

X Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  15 (X_QueryTree)
  Resource id in failed request:  0x6a04d88
  Serial number of failed request:  58195
  Current serial number in output stream:  58195
1
  • Post a minimal reproducible example and debugging details, including the information on the environment, such as OS version, Python version, versions of packages, etc. It works fine in my Ubuntu 20.04.
    – relent95
    Commented Apr 5, 2023 at 5:19

1 Answer 1

3

I guess you are experiencing the same as described in the following already closed open3d issue using the old visualization gui stuff.

https://github.com/isl-org/Open3D/issues/1715

As stated there the best solution found so far is to switch to the new filament based gui as that is aware of other windows not controlled by open3d visualization gl code.

The sort answer is that visualization methods switch focus of gl window to front and than assume that no other window in the same program steals them the focus. Consequently when switching to tkinter gui open3d visualization code will not notice that it is not drawing to gl window but to the tkinter which it has no access to. - Any other program would whenever entering gl drawing code simply ensure that it is drawing to the right window and grab focus.

EDIT: The above is true for what you have written in your post. But it is not true when you meant what you have put in headline "After running an open3d window and closing it, tkinter messagebox crashes and gives X Error of failed request: BadWindow (invalid Window Parameter)".

Your post made me assume the visualization window is still open. So do you close the visualization window and then open the tkinter window or open the tkinter window while the open3d visualization is open?

EDIT Did some research in my own project. Tkinter is the nasty ignoring beast. I finally resorted to use subprocess module to sandbox the filedialog.askdirectory and messagebox.askyesnocanel. My solution you can find on https://github.com/isl-org/Open3D/issues/6125 .

Sorry not having better news than saying Tkinter is the bad and evil.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.