IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Tkinter Python Discussion :

Impossible d'importer Tkinter avec karrigell.


Sujet :

Tkinter Python

  1. #1
    Membre à l'essai
    Profil pro
    Client Solution Developer
    Inscrit en
    Janvier 2011
    Messages
    23
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations professionnelles :
    Activité : Client Solution Developer

    Informations forums :
    Inscription : Janvier 2011
    Messages : 23
    Points : 21
    Points
    21
    Par défaut Impossible d'importer Tkinter avec karrigell.
    Bonjour,

    J'ultilise karigell 3.1.1. pour créer une page web à partir de laquelle s'exécutera un script python. Dans ce script, j'utilise Tkinter que j'importe à l'aide de:
    Cependant, karrigell me dit qu'il n'y a pas de module "Tkinter":
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    Error in /canevas.py
    Line 4    
    import Tkinter
    ImportError: No module named Tkinter
     
    Traceback (most recent call last):
      File "C:\Karrigell-3.1.1\karrigell\core\HTTP.py", line 333, in process_request
      File "C:\Karrigell-3.1.1\karrigell\core\k_target.py", line 399, in run
      File "", line 4, in 
    ImportError: No module named Tkinter
    Tkinter fait pourtant partie de la distribution standard de python et il me semble donc, d'après la doc sur karrigell, j'ai correctement importé Tkinter: http://karrigell.sourceforge.net/fr/import.html.

    Quelqu'un peut-il m'aider?

    Merci d'avance?

  2. #2
    Expert éminent

    Homme Profil pro
    Inscrit en
    Octobre 2008
    Messages
    4 302
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations forums :
    Inscription : Octobre 2008
    Messages : 4 302
    Points : 6 782
    Points
    6 782
    Par défaut
    Bonjour,

    Si tu utilises python3, c'est tkinter et non pas Tkinter.

    Sinon fais l'import avec l'interpréteur interactif et vois le résultat.

  3. #3
    Expert éminent sénior
    Homme Profil pro
    Architecte technique retraité
    Inscrit en
    Juin 2008
    Messages
    21 398
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Manche (Basse Normandie)

    Informations professionnelles :
    Activité : Architecte technique retraité
    Secteur : Industrie

    Informations forums :
    Inscription : Juin 2008
    Messages : 21 398
    Points : 36 957
    Points
    36 957
    Par défaut grilled
    Salut,
    Quelle version de Python utilisez vous?
    Sous Python 3, "Tkinter" s'appelle "tkinter".
    - W

  4. #4
    Membre à l'essai
    Profil pro
    Inscrit en
    Novembre 2009
    Messages
    10
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2009
    Messages : 10
    Points : 14
    Points
    14
    Par défaut
    Comme c'est Karrigell-3.1.1 on est en Python2.X donc c'est bien Tkinter

    J'ai fait le test sur mon PC, l'import fonctionne normalement. L'import d'autres modules de la distribution standard fonctionne-t-il normalement ? Que se passe-t-il quand tu fais 'import Tkinter' dans l'interpréteur interactif

  5. #5
    Expert éminent

    Homme Profil pro
    Inscrit en
    Octobre 2008
    Messages
    4 302
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations forums :
    Inscription : Octobre 2008
    Messages : 4 302
    Points : 6 782
    Points
    6 782
    Par défaut
    Il ne se passe rien, ce qui signifie que l'import est correct.

    vincent@tiemoko:~$ python
    Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
    [GCC 4.4.3] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import Tkinter
    >>>

  6. #6
    Membre à l'essai
    Profil pro
    Inscrit en
    Novembre 2009
    Messages
    10
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2009
    Messages : 10
    Points : 14
    Points
    14
    Par défaut
    Merci VinsS, mais je posais plutôt la question à pieral85

  7. #7
    Membre à l'essai
    Profil pro
    Client Solution Developer
    Inscrit en
    Janvier 2011
    Messages
    23
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations professionnelles :
    Activité : Client Solution Developer

    Informations forums :
    Inscription : Janvier 2011
    Messages : 23
    Points : 21
    Points
    21
    Par défaut
    J'utilise python 2.7.3 donc il faut bien importer Tkinter (avec majuscule).

    Avec l'interpréteur interactif, aucun problème pour l'import (que ce soit Tkinter ou tout au module de la distribution standard) mais je devrais peut-être préciser mon problème:
    1. J'enregistre mon fichier python mon_fichier.py (dans lequel j'essaie d'importer Tkinter) dans le répertoire suivant: C:\Karrigell-3.1.1\www
    2. J'ouvre le serveur de Karrigell à l'aide de Karrigell.exe
    3. A partir de mon navigateur internet (Firefox), je tape l'adresse suivante: http://localhost/mon_fichier.py. C'est sur la page internet que le message d'erreur (cfr mon 1er post) comme quoi Tkinter ne peut être importé apparaît.


    Python possède donc bien le module Tkinter mais c'est Karrigell qui semble ne pas l'avoir.

  8. #8
    Expert éminent sénior
    Homme Profil pro
    Architecte technique retraité
    Inscrit en
    Juin 2008
    Messages
    21 398
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Manche (Basse Normandie)

    Informations professionnelles :
    Activité : Architecte technique retraité
    Secteur : Industrie

    Informations forums :
    Inscription : Juin 2008
    Messages : 21 398
    Points : 36 957
    Points
    36 957
    Par défaut
    Citation Envoyé par pieral85 Voir le message
    Python possède donc bien le module Tkinter mais c'est Karrigell qui semble ne pas l'avoir.
    Ce qui semble raisonnable puisque tkinter demande l'accès à la console graphique du serveur et ses sorties ne seront pas exploitables via le navigateur web qui provoque le lancement du script.
    - W

  9. #9
    Membre à l'essai
    Profil pro
    Inscrit en
    Novembre 2009
    Messages
    10
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2009
    Messages : 10
    Points : 14
    Points
    14
    Par défaut
    @pieral85

    Je vois. Karrigell.exe est construit par py2exe, qui pour des raisons de taille n'embarque que les modules de la distribution standard qui sont utilisés dans le package Karrigell. Comme Tkinter n'en fait pas partie, l'import de ce module échoue

    Si tu télécharges Karrigell sous forme de fichier tar.gz c'est l'interpréteur Python installé sur la machine qui sera utilisé, avec tous ses modules, donc "import Tkinter" doit fonctionner

    Par curiosité, pourquoi cherches-tu à utiliser Tkinter depuis un script qui tourne sur un serveur web ?

    - Pierre

Discussions similaires

  1. Impossible d'importer tkinter
    Par Bisk84 dans le forum Tkinter
    Réponses: 7
    Dernier message: 19/03/2013, 06h41
  2. [WD14] Impossible d'importer PostGreSQL avec character varying
    Par klbsjpolp dans le forum WinDev
    Réponses: 3
    Dernier message: 24/03/2010, 16h39
  3. [phpMyAdmin] Impossible d'importer une base avec phpadmin
    Par jzik_fr dans le forum EDI, CMS, Outils, Scripts et API
    Réponses: 2
    Dernier message: 21/08/2008, 23h19
  4. Impossible de se connecter avec aMSN
    Par Blowih dans le forum Applications et environnements graphiques
    Réponses: 5
    Dernier message: 29/07/2004, 14h51
  5. Réponses: 4
    Dernier message: 25/08/2003, 09h02

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo