Créer/Séparer un canvas et une zone "paramètre" dans une fenêtre Tkinter
Bonjour,
j'essaye de créer un logiciel se présentant sous une forme assez simple. Sur le premier tier gauche de la fenêtre, il y a une zone "paramètre" où l'on pourra entrer différentes variables, etc. et sur les 2/3 suivants, il y a un canvas.
Je cherche un moyen de créer ces deux entités, et de pouvoir les séparer et les arranger comme ci-dessus.
Code :
Code:
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
|
from tkinter import *
from math import *
"""-------------------------"""
"""--------VARIABLES--------"""
"""-------------------------"""
#PARAMETRES FONDAMENTAUX
y_sol = 690
#VARIABLES PHYSIQUES
m = 20 #kilogrammes
g = 9.81
a = -g
h = 70 #mètres
y = 720 - h*10 #pixels (1 mètres = 10 pixels)
dt = 0.01
pas = 0.01
v0 = 0
t = 1
"""-------------------------"""
"""CONFIGURATION APPLICATION"""
"""-------------------------"""
#CONFIG FENETRE
bg_color = "#222222"
window = Tk()
window.title("Physicsim")
window.geometry("1080x720")
window.minsize(480, 360)
#window.iconbitmap("logo.ico")
window.config(background=bg_color)
#CONFIG FRAMES
simu_chute = LabelFrame(window, text="Hello")
parameters = LabelFrame(window, text="Bye !")
simu_chute.grid(row=0, column=0)
parameters.grid(row=1, column=0)
#CONFIG CANVAS
canvas = Canvas(simu_chute, bg=bg_color)
canvas.grid(row=0, column=4)
#CONFIG MENUS
menu_bar = Menu(window)
file_menu = Menu(menu_bar, tearoff=0)
file_menu.add_command(label="Fermer Physicsim", command=window.quit)
menu_bar.add_cascade(label="Fichier", menu=file_menu)
window.config(menu=menu_bar)
#CREATION IMG
img = PhotoImage(file="images/apple.png")
photo = canvas.create_image(0, y, anchor=NW, image=img)
"""------------------------"""
"""-------SIMULATION-------"""
"""------------------------"""
def chute_rectiligne(a,t,m,dt,y):
while y < y_sol:
y_relatif = -((a*t)/m)
x_relatif = 0
t += 1
y += y_relatif
canvas.move(photo, x_relatif, y_relatif)
dt += pas
canvas.update()
canvas.after(1)
#AFFICHER FENETRE
window.mainloop() |
J'ai essayé avec des LabelFrame, soit c'est pas ça, soit je m'y suis mal pris...
Auriez-vous une idée ?
Merci,
Phizik