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() |
Partager