Skip to content
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

Tkinter methods lift(), lower(), deiconify() and geometry() not working (properly or at all) #691

Open
Babber opened this issue Apr 24, 2024 · 5 comments

Comments

@Babber
Copy link

Babber commented Apr 24, 2024

Distribution

Linux Mint 21.3 Cinnamon; LMDE 6 Faye

Package version

6.0.4

Graphics hardware in use

No response

Frequency

Always

Bug description

While everything works flawlessly on Xubuntu 22, I experience the following issues on various Cinnamon desktops.

Please, consider the steps below in a Python3 interpreter:

from tkinter import *
root=Tk()

One can then minimize the widget window either by calling root.iconify() or using the window manager's dedicated button for this.

  • Problem 1: root.deiconify() won't bring the window back on the desktop, it stays minimized.
    • A sub-optimal workaround is root.withdraw(); root.deiconify(), but this changes the widgets location on the desktop and also its icon on the taskbar shits to the end.
    • Hint: on Xubuntu, root.iconify() executes in no time, while on LM, root.iconify() is hanging for a few seconds after minimizing the widget as if it was waiting for something?..

If you don't minimize this window, but move another window of whatever application over it, you face...

  • Problem 2: root.lift() won't raise it to the top, it stays hidden under the other window.
    • As a workaround, root.focus_force(); root.lift() does the job, but it steals the focus. root.attributes('-topmost', 1); root.attributes('-topmost', 0) might be a perfect workaround though.

After lifting it, let's say, you want to lower it again...

  • Problem 3: root.lower() won't do anything. Here too, I am only aware of the sub-optimal workaround with root.focus_force(); root.lower(), which leaves the focus on a widget that is not even visible.

  • Problem 4: please, consider the script below:

from tkinter import *

root = Tk()
root.geometry('200x200-0-0')

def func():
    root.geometry('-100-100')
    root.geometry('-0-0')
    print(root.geometry())

b = Button(root, text='push me', command=func)
b.pack()

root.mainloop()

On Cinnamon, the first push on the button makes the whole widget jump around 20 pixels up and left, subsequent clicks on the button don't do anything. Nevertheless, it keep printing 200x200-0-0 even though it's obviously not there. The example works with other coordinates too, it doesn't have to be -0-0. On Xubuntu, the widget stays in the corner as it is supposed to.

I guess this is not an extensive list of similar issues at least with the newest versions of python3-tk (3.10.8-1 on Linux Mint 21.3 Cinnamon and 3.11.2-3 on LMDE 6 Faye). I wonder where exactly the problems might hide, since none of these issues appear on Xubuntu 22. I would guess, it has to do with the different window managers, this is why I posted here as well. (I posted about these issues first on stackoverflow.)

Any insights and workarounds would be very welcome!

Steps to reproduce

Please, see above.

Expected behavior

Please, see above.

Additional information

No response

@rcalixte
Copy link
Member

Would you be able to test this on Xubuntu 24.04 when it comes out in a few days? It would be helpful to know if this is a change with the upstream or something that can be fixed locally within Cinnamon.

@Babber
Copy link
Author

Babber commented Apr 24, 2024

Thank you for the quick comment, @rcalixte.
I can do the experiment with a live system. I'll get back to you with the results.

@Babber
Copy link
Author

Babber commented May 28, 2024

So I have tested this on Xubuntu 24.04 and I have made two observations:

  1. Problems 1, 2, 3 are no problems on the most recent Xubuntu, everything is working as it is supposed to.

  2. Contrary to my original report, problem 4 is actually a problem on all platforms that is on Xubuntu as well. Apparently the position of the widget is handled a bit inconsistently if there are more than one displays and together they don't form a uniform rectangle but they are joined together as separate rectangles with misaligned corners, e.g. like this:

  -----------
  |         |
  |         |
---------------
|             |
|             |
---------------

This also means that problem 4 is probably an issue with Tkinter itself and has nothing to do with Muffin. So we can focus here on problems 1, 2 and 3.

@rcalixte
Copy link
Member

So I have tested this on Xubuntu 24.04 and I have made two observations:

1. Problems 1, 2, 3 are no problems on the most recent Xubuntu, everything is working as it is supposed to.

Will you be able to test on Mint 22 when it is released? I wonder if this is a system dependency that has been updated (and will therefore be fixed in Debian 13/LMDE 7).

@Babber
Copy link
Author

Babber commented Aug 20, 2024

Hi @rcalixte
I have just tested these problems on the new Linux Mint 22, but the situation is the same, no improvement unfortunately.

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

No branches or pull requests

2 participants