[issue22133] IDLE: Set correct WM_CLASS on X11

Serhiy Storchaka report at bugs.python.org
Sun Aug 24 13:06:56 CEST 2014


Serhiy Storchaka added the comment:

> Grepping idlelib for 'toplevel, there are about 10. Do all of the Toplevels get put on the activity bar?  I would not expect that popups like calltip would.

I don't know how dialogs and calltip popups behave on Gnome Shell. But I think we should do this at least for more or less long-lived windows such as stack viewer. On KDE when I added ``kw["class"] = 'Idle3'`` to ListedToplevel constructor, console and editor windows are grouped on taskbar, and stack viewer is separated (without this line all three windows are in the same group).

> I expect that all ListedToplevels could be handled at once by adding the following as the first line of ListedToplevel.__init__.

May be, but this is not so simple. To be robust we should handle both 'class' and 'class_' keywords (and may be even '-class').

> What is wrong with simply adding classname to the Tk() call, as Roger suggested in #13553.

This affects only WM_CLASS of root window (which is withdrawn right after creation in IDLE).

> Does KDE display 2 windows without name='Idle' in the toplevel call?  Is this a KDE or tk bug?

``tk = Tk(className='Idle3')`` creates first (root) window and ``top = Toplevel(tk, class_='Idle3')`` creates second window. The className argument affects root window (and some other things) and the class argument affects Toplevel window.

Another example:

>>> from tkinter import *
>>> tk = Tk(className='Firefox')
>>> top = Toplevel(tk, class_='Chromium-browser')

Created two windows: one with title "firefox" and Firefox icon, and other with title "firefox" and Chromium icon.

I argue that we should add className="Idle3" to every Tk constructor and class_="Idle3" to most (iv not every) Toplevel constructor. On Python 2 it should be "Idle2" or "Idle" (not sure).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22133>
_______________________________________


More information about the Python-bugs-list mailing list