Problem mit python-tk [gelöst]

Warum Debian und/oder eine seiner Spielarten? Was muss ich vorher wissen? Wo geht es nach der Installation weiter?
Antworten
Benutzeravatar
mikrokosmos
Beiträge: 225
Registriert: 26.07.2006 19:38:24

Problem mit python-tk [gelöst]

Beitrag von mikrokosmos » 23.09.2006 15:09:06

Hallo,

ich habe ein Problem mit der Benutzung von Tkinter in Python. Das Paket (python-tk bzw python2.x-tk) lässt sich installieren, will ich dann aber Tkinter auch benutzen gibt es eine unschöne Fehlermeldung:

Code: Alles auswählen

Python 2.5c1 (r25c1:51305, Aug 19 2006, 18:23:29)
[GCC 4.1.2 20060814 (prerelease) (Debian 4.1.1-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Tkinter
>>> Tkinter.Tk()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/lib-tk/Tkinter.py", line 1639, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: this isn't a Tk applicationunknown color name "Black"
Das Problem tritt allerdings nicht nur in Python 2.5 auf, sondern auch in Python 2.3 und Python 2.4, unabhängig davon, ob ich Etch oder Sid verwende.

Zudem scheint es sich dabei um ein Debianspezifisches Problem zu handeln, da es mir bisher nur in den Debianoiden (Debian, Ubuntu, Kanotix) aufgefallen ist, allerdings nicht in openSuse und Arch Linux.

Die Frage richtet sich natürlich vor allem an diejenigen hier, die auch Programme in Python schreiben. Wie bekomme ich Tkinter in Python zum Laufen?

Danke schonmal im Voraus,
mikrokosmos

PS: Ich hoffe einmal, mit "Grundsatzfragen" das richtige Unterforum erwischt zu haben, weil es sich ja doch um ein Problem handelt, das speziell auf Debian bezogen ist.
Zuletzt geändert von mikrokosmos am 24.09.2006 09:26:29, insgesamt 1-mal geändert.

Benutzeravatar
Mr_Snede
Beiträge: 2323
Registriert: 08.07.2003 13:48:49
Lizenz eigener Beiträge: MIT Lizenz
Wohnort: Ruhrpott

Beitrag von Mr_Snede » 23.09.2006 15:19:27

Kann diese Fehlermeldung bei mir nicht reproduzieren(ich benutze debian testing). Bei mir funktioniert

Code: Alles auswählen

Python 2.4.4c0 (#2, Jul 30 2006, 15:43:58)
[GCC 4.1.2 20060715 (prerelease) (Debian 4.1.1-9)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Tkinter
>>> Tkinter.Tk()
<Tkinter.Tk instance at 0xa7d580cc>
>>>
ohne Probleme.

Bei mir sind folgende Python Pakete installiert:

Code: Alles auswählen

mr_snede@pc-etch:~$ dpkg -l | grep python
ii  python                          2.4.3-11                 An interactive high-level object-oriented la
ii  python-apt                      0.6.19                   Python interface to libapt-pkg
ii  python-cairo                    1.2.0-1                  Python bindings for the Cairo vector graphic
ii  python-central                  0.5.5                    register and build utility for Python packag
ii  python-ctypes                   1.0.0-1                  Python package to create and manipulate C da
ii  python-glade2                   2.8.6-5                  GTK+ bindings: Glade support
ii  python-gst0.10                  0.10.5-3                 generic media-playing framework (Python bind
ii  python-gtk2                     2.8.6-5                  Python bindings for the GTK+ widget set
ii  python-imaging                  1.1.5-11                 Python Imaging Library
ii  python-ipy                      0.42-7                   Python module for handling IPv4 and IPv6 add
ii  python-libxml2                  2.6.26.dfsg-3            Python bindings for the GNOME XML library
ii  python-minimal                  2.4.3-11                 A minimal subset of the Python language (def
ii  python-mutagen                  1.6-1                    audio metadata editing library
ii  python-newt                     0.52.2-7                 A NEWT module for Python
ii  python-numeric                  24.2-6                   Numerical (matrix-oriented) Mathematics for
ii  python-pyogg                    1.3-1.1                  A Python interface to the Ogg library
ii  python-pyorbit                  2.0.1-5                  A Python language binding for the ORBit2 COR
ii  python-pyvorbis                 1.3-1.2                  A Python interface to the Ogg Vorbis library
ii  python-support                  0.4.3                    automated rebuilding support for python modu
ii  python-tk                       2.4.3-5                  Tkinter - Writing Tk applications with Pytho
ii  python-uno                      2.0.3-6                  Python interface for OpenOffice.org
ii  python-vte                      0.12.2-4                 Python bindings for the VTE widget set
ii  python-xdg                      0.15-1.1                 A python library to access freedesktop.org s
ii  python2.4                       2.4.3-8                  An interactive high-level object-oriented la
ii  python2.4-minimal               2.4.3-8                  A minimal subset of the Python language (ver
Wobei die nicht alle für tkinter benötigt werden. Bei mir hat ein "apt-get install python-tk" ausgereicht.
Software Finder - Software in Kategorien Debian ohne Ballast - Tipps für ein schlankes Debian

Benutzeravatar
mikrokosmos
Beiträge: 225
Registriert: 26.07.2006 19:38:24

Beitrag von mikrokosmos » 23.09.2006 15:27:01

Danke für deine Antwort, Mr_Snede.
Ich habe schon befürchtet, dass es sich eher um ein "individuelleres" Problem handelt, denn ansonsten würde ich bei einer Suchmaschine im Internet wohl auch etwas dazu finden.
Eigenartig ist daran aber, dass - wie ich schon sagte - das Problem unter Ubuntu, Kanotix und Debian auftaucht - also bei 3 komplett getrennten Installationen. Aber an meiner Hardware wirds ja wohl nicht liegen, dass Tkinter unter debianoiden Linuxen Probleme hat. (Zumindest halte ich das für sehr unwahrscheinlich. ;))

Benutzeravatar
Mr_Snede
Beiträge: 2323
Registriert: 08.07.2003 13:48:49
Lizenz eigener Beiträge: MIT Lizenz
Wohnort: Ruhrpott

Beitrag von Mr_Snede » 23.09.2006 17:22:40

Auf die Schnelle habe ich auch ma google angeworfen:
http://ubuntuforums.org/showthread.php?p=858323
Software Finder - Software in Kategorien Debian ohne Ballast - Tipps für ein schlankes Debian

Benutzeravatar
mikrokosmos
Beiträge: 225
Registriert: 26.07.2006 19:38:24

Beitrag von mikrokosmos » 23.09.2006 18:50:53

Ich danke dir, Mr_Snede.
Die Schritte - in leicht angepasster Form - haben den gewünschten Erfolg erzielt. :)

Das Problem wäre damit gelöst, aber mich würde noch interessieren, warum bei meinen Installationen die /usr/X11R6/lib/X11/rgb.txt fehlte, aber beispielweise bei dir vorhanden war. :roll:

Antworten