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

Python Discussion :

fenêtre Tkinter vide


Sujet :

Python

  1. #1
    Nouveau candidat au Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Octobre 2019
    Messages
    1
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 24
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Octobre 2019
    Messages : 1
    Par défaut fenêtre Tkinter vide
    Bonjour, je suis en train de créer un jeu, dans une des fenêtres Tkinter, les gens pourront modifier les touches pour bouger, en revanche quand je lance ma fenêtre Tkinter elle apparait vide (une fenêtre par défaut), ça doit être une vieille erreur à la con mais je ne la trouve pas si quelqu'un la voit je suis preneur

    Nom : erreur par defaut.png
Affichages : 293
Taille : 8,2 Ko

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    from tkinter import *
     
    class Menu:
    	def __init__(self, root):
    		self.root = root()
     
    		self.root.geometry("400x400")
    		self.root.configure(width=300,height=200)
    		self.root.title('Option')
    		# root.backgroundimage()
     
    		Button(self.root, text = 'Lancer', commande = self.LunchGame).grid(row = 2, sticky = W)
    		Button(self.root, text = 'Option', commande = self.Option).grid(row = 2, sticky = E)
     
     
     
    	# def backgroundimage(self):
    		# self.can = Canvas(self.root, width = 250, height = 250, bg = 'bg_menu').grid(width = 250, height = 250)
     
     
    	def LunchGame():
     
    	    LunchGameWindow = Tk()
     
    	    LunchGameWindow.geometry("200x150")
     
    	    LunchGameWindow.title("Jeu")
     
    	def Option():
     
    		Keys= {}
     
    		def change_Focus (self,args) :
     
    			self.Current_Window = int(args.widget)
     
    		def attribute_Key(self,args) :
     
    			for entry[2] in self.Keys :
     
    				if self.Current_Window == int(entry[2]) :
     
    					entry[1].est(args.Keysym_num)
     
    					open("salut").write()
     
    					entry[2].itemconfig(state = "disabled")
     
    					break
     
    		def chage_State (self,args) : 
     
    			for entry[2] in self.Keys : 
     
    				if self.Current_Window == int(entry[2]) :
     
    					entry[2].itemconfig(state="normal")
     
    					break
     
    		for key in Key_Binding : 
     
    			"entre temporaire"
     
    			Value = tkinter.StringVar()
     
    			Value.set(key) <="up"
     
    			State = "normal"
     
    			Entry_Iter = Entry(textvariable = Value,state = state)
     
    			"up"
     
    			self.Key_Binding[key] = (State,Value,Entry_Iter)
     
    		self.root.bind("<KeyRelease>",self.attribute_Key)
    		self.root.bind("<Entry>",self.change_Focus)
    		self.root.bind("<Double-Button-1>",self.change_State)
     
     
    		OptionWindow=Tk()
     
    		OptionWindow.geometry("1265x720")
     
    		OptionWindow.title("Option")
     
    		title=Label(OptionWindow, text = 'Option de clavier')
    		title.grid(row = 0, column = 0)
     
    		up=Label(OptionWindow, text="up")
    		up.grid(row = 1, column = 0)
     
    		up_entry=Entry(OptionWindow, textvariable = Value)
    		up_entry.grid(row = 1, column = 1) 
     
    		down=Label(OptionWindow, text="Down")
    		down.grid(row = 2, column = 0)
     
    		down_entry=Entry(OptionWindow, textvariable = Value)
    		down_entry.grid(row = 2, column = 1)
     
    		left=Label(OptionWindow, text="Left")
    		left.grid(row = 3, column = 0)
     
    		left_entry=Entry(OptionWindow, textvariable = Value)
    		left_entry.grid(row = 3, column = 1)
     
    		right=Label(OptionWindow, text="right")
    		right.grid(row = 4, column = 0)
     
    		right_entry=Entry(OptionWindow, textvariable = Value)
    		right_entry.grid(row = 4, column = 1)
     
    root = Tk()
    app = Menu()
    root.mainloop()
    Merci d'avance

  2. #2
    Expert confirmé

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

    Informations forums :
    Inscription : Octobre 2008
    Messages : 4 307
    Par défaut
    Salut,

    Désolé mais ton code ne ressemble à rien du tout.

    Sur la capture écran ta fenêtre n'a pas de titre. Demande-toi pourquoi.

    Ta classe capture demande un argument.
    Tu crées plusieurs fenêtres principales Tk() on ne peut pas, regarde du côté des TopLevel.
    Tes fonctions LunchGame et Option n'ont pas de self en argument.
    Ta fonction Option contient des sous-fonctions, quelle nécessité ?
    etc ...

Discussions similaires

  1. Réponses: 4
    Dernier message: 16/05/2017, 10h24
  2. VS 2005 Fenêtre propriétés vide en mode source
    Par yann47 dans le forum VB.NET
    Réponses: 2
    Dernier message: 18/12/2007, 11h29
  3. Problème de fenêtres services vides
    Par Xhayn dans le forum Windows
    Réponses: 4
    Dernier message: 02/08/2007, 16h28
  4. PLusieurs fenêtre Tkinter
    Par peyro dans le forum Tkinter
    Réponses: 2
    Dernier message: 14/06/2006, 15h04
  5. Problème d'affichage: fenêtres (frames) vides!
    Par NdmaX dans le forum Agents de placement/Fenêtres
    Réponses: 6
    Dernier message: 12/07/2005, 21h23

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