This commit is contained in:
Lukian LEIZOUR 2024-08-15 17:06:52 +02:00
parent 0b181013ed
commit 40871f7cd5

10
main.py
View file

@ -2,8 +2,8 @@ from tkinter import *
from math import sqrt from math import sqrt
from time import sleep from time import sleep
WIDTH = 900 WIDTH = 1400
HEIGHT = 600 HEIGHT = 800
class Planet: class Planet:
def __init__(self, canvas, size, mass, color, x, y): def __init__(self, canvas, size, mass, color, x, y):
@ -96,8 +96,6 @@ class System():
def main(): def main():
window = Tk() window = Tk()
fps_limit = 75
canvas = Canvas(window, bg="black", width=WIDTH, height=HEIGHT) canvas = Canvas(window, bg="black", width=WIDTH, height=HEIGHT)
canvas.pack() canvas.pack()
@ -126,10 +124,10 @@ def main():
blue_moon.orbit(earth) blue_moon.orbit(earth)
while True: while True:
system.update_all(time.get() / fps_limit, scale.get()) system.update_all(time.get() / fps.get(), scale.get())
window.update_idletasks() window.update_idletasks()
window.update() window.update()
sleep(1 / fps_limit) sleep(1 / fps.get())
if __name__ == "__main__": if __name__ == "__main__":