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

ttkthemes breaks Tk #93

Open
olebole opened this issue Oct 7, 2022 · 2 comments
Open

ttkthemes breaks Tk #93

olebole opened this issue Oct 7, 2022 · 2 comments
Assignees

Comments

@olebole
Copy link

olebole commented Oct 7, 2022

For the Debian package of ttkthemes, I got a the bug report Debian#1021389:

When this package is installed, 'tclsh' (the Tcl interpreter, provided by debian package 'tcl') becomes broken in such a way that it's no longer possible to import/load the Tk graphics/gui extension (provided by debian package 'tk').

Although I'm reporting from a Debian Stable system, this bug is happening in Ubuntu too, and this package seems obscure so I assume this may still be an issue that nobody else has noticed or fixed yet.

Steps to reproduce:

  1. Start a X windows/desktop session.
  2. Install debian packages 'tcl', and 'tk', and 'tcl-ttkthemes', perhaps with this command or similar:
     sudo apt-get install tcl tk tcl-ttkthemes
    
  3. Create a text file with the name 'test.tcl' and put these lines in it:
    package require Tk
    pack [ label .l -text "Debian" ]
    
  4. Open a terminal window and run this command:
     tclsh test.tcl
    
  5. Observe that this error message is printed and the script exits:
     circular package dependency: attempt to provide Tk Ϻ£ü requires Tk
     while executing "package require Tk"
       (file "test.tcl" line 1)
    
  6. Uninstall debian package 'tcl-ttkthemes'.
  7. Run 'tclsh test.tcl' again, and note that this time the error is not printed and the script opens a window with text "Debian" in it.

The reason for this seems the lines

package require Tk 8.6

and
package require Tk 8.6

which were introduced in 87fa24f (part of #66).

Removing these lines fixes the problem; however I am not sure whether ttkthemes then still works properly. Can you check that?

@RedFantom
Copy link
Member

RedFantom commented Oct 8, 2022

Interesting! The Debian package is not maintained by myself, but I can certainly imagine that this is troublesome... The package require lines are not necessary for ttkthemes to work in a Python/Tkinter-context. However, I am a bit confused that ttkthemes appears to get auto-loaded when loading Tk. That's where I would imagine the circular-import error comes from.

I think that might be because of this file (Disclaimer: I have never actually built Debian packages from scratch!)

Either you'd have to file some bug report with the maintainer of the Debian package. Otherwise, I'll consider removing the lines. The reason they're there is enforce Tk 8.6 over, say, Tk 8.5 (shipped with Python 2.7). Let me know your thoughts, and in case you find where to open a bug report with the maintainers, I can opine over there as well.

Edit: I should improve my reading skills 🤦🏻‍♂️ . Sorry, I did not immediately realize that you are actually the packager for Debian (#77). There are two options, I think. Either:

  1. The package require line is removed, making the non-support for Python 2.7/Tk <8.6 implicit
  2. ttkthemes is no longer auto-loaded when Tk is loaded, which I think can be implemented by updating the Debian package

Personally, I am in favour of option 2.

@RedFantom RedFantom self-assigned this Oct 8, 2022
@olebole
Copy link
Author

olebole commented Oct 8, 2022

I added the pkgIndex.tcl in the Debian package to make ttkthemes easily loadable in SAOImageDS9 with package require ttk::theme::XXX, for which it is a dependency.
Since Debian only supports Tcl8.6 and Python 3, I'd prefer option 1, and could remove the package require lines also locally in the Debian package. However, it may be that I misunderstood something and there is a better solution than my hand-made pkgIndex.tcl.

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