import controller # Construct a simple root window root = Tk() root.title("Simulation") root.protocol("WM_DELETE_WINDOW", quit) frame = Frame(root) # Place buttons simply at the top frame.pack(side=TOP) controller.reset_button(frame, text="Reset").pack(side=LEFT) controller.start_button(frame, text="Start").pack(side=LEFT) controller.stop_button(frame, text="Stop").pack(side=LEFT) controller.step_button(frame, text="Step").pack(side=LEFT) controller.object_button(frame, text="Ball").pack(side=LEFT) controller.object_button(frame, text="Floater").pack(side=LEFT) controller.object_button(frame, text="Black_Hole").pack(side=LEFT) controller.object_button(frame, text="Pulsator").pack(side=LEFT) controller.object_button(frame, text="Hunter").pack(side=LEFT) controller.object_button(frame, text="Special").pack(side=LEFT) controller.object_button(frame, text="Remove").pack(side=LEFT) controller.progress(frame, text="0 updates/0 simultons", width=25, relief=RAISED).pack(side=LEFT) # Place canvas in the space below controller.simulation_canvas(root, width=500, height=300, bg="white").pack(side=BOTTOM,
from tkinter import Tk,Frame,TOP,LEFT,BOTTOM,RAISED,BOTH # import controller to call/create widgets and position them in the view import controller # Construct a simple root window root = Tk() root.title("Simulation") root.protocol("WM_DELETE_WINDOW",quit) frame = Frame(root) # Place buttons simply at the top frame.pack(side=TOP) controller.reset_button (frame,text="Reset") .pack(side=LEFT) controller.start_button (frame,text="Start") .pack(side=LEFT) controller.stop_button (frame,text="Stop") .pack(side=LEFT) controller.step_button (frame,text="Step") .pack(side=LEFT) controller.object_button(frame,text="Ball") .pack(side=LEFT) controller.object_button(frame,text="Floater") .pack(side=LEFT) controller.object_button(frame,text="Black_Hole").pack(side=LEFT) controller.object_button(frame,text="Pulsator") .pack(side=LEFT) controller.object_button(frame,text="Hunter") .pack(side=LEFT) controller.object_button(frame,text="Special") .pack(side=LEFT) controller.object_button(frame,text="Remove") .pack(side=LEFT) controller.progress (frame,text="0 updates/0 simultons",width=25,relief=RAISED).pack(side=LEFT) # Place canvas in the space below controller.simulation_canvas(root,width=500,height=300,bg='#000000').pack(side=BOTTOM,expand=True,fill=BOTH)
# Construct a simple root window root = Tk() root.title("Simulation") root.protocol("WM_DELETE_WINDOW", quit) frame = Frame(root) # Place buttons simply at the top frame.pack(side=TOP) controller.reset_button(frame, text="Reset").pack(side=LEFT) controller.start_button(frame, text="Start").pack(side=LEFT) controller.stop_button(frame, text="Stop").pack(side=LEFT) controller.step_button(frame, text="Step").pack(side=LEFT) #controller.object_button(frame,text="Ball") .pack(side=LEFT) controller.object_button(frame, text="Floater").pack(side=LEFT) #controller.object_button(frame,text="Black_Hole").pack(side=LEFT) #controller.object_button(frame,text="Pulsator") .pack(side=LEFT) #controller.object_button(frame,text="Hunter") .pack(side=LEFT) controller.object_button(frame, text="Bacteria").pack(side=LEFT) controller.object_button(frame, text="Phage").pack(side=LEFT) controller.object_button(frame, text="Remove").pack(side=LEFT) controller.progress(frame, text="0 updates/0 simultons", width=25, relief=RAISED).pack(side=LEFT) # Place canvas in the space below controller.simulation_canvas(root, width=500, height=300, bg="white").pack(side=BOTTOM, expand=True,
frame2 = Frame(root) frame3 = Frame(root) frame4 = Frame(root) # Place buttons simply at the top frame0.pack(side=TOP) frame.pack(side=TOP) frame2.pack(side=TOP) frame3.pack(side=TOP) frame4.pack(side=TOP) controller.progress(frame0, text="0 updates/0 simultons", width=25, relief=RAISED).pack(side=LEFT) controller.reset_button(frame, text="Reset").pack(side=LEFT) controller.start_button(frame, text="Start").pack(side=LEFT) controller.stop_button(frame, text="Stop").pack(side=LEFT) controller.step_button(frame, text="Step").pack(side=LEFT) controller.object_button(frame, text="Remove").pack(side=LEFT) controller.object_button(frame2, text="Static_simulton").pack(side=LEFT) controller.object_button(frame2, text="Mobile_simulton").pack(side=LEFT) controller.object_button(frame3, text="Super_simulton1").pack(side=LEFT) controller.object_button(frame3, text="Super_simulton2").pack(side=LEFT) controller.object_button(frame4, text="Super_simulton3").pack(side=LEFT) controller.object_button(frame4, text="Super_simulton4").pack(side=LEFT) # controller.object_button(frame,text="Special") .pack(side=LEFT) # Place canvas in the space below controller.simulation_canvas(root, width=400, height=400, bg="yellow").pack(side=BOTTOM, expand=True, fill=BOTH)
# Construct a simple root window root = Tk() root.title("Simulation") root.resizable(width=False, height=False) root.protocol("WM_DELETE_WINDOW", quit) frame = Frame(root) # Place buttons simply at the top frame.pack(side=TOP) controller.reset_button(frame, text="Reset").pack(side=LEFT) controller.start_button(frame, text="Start").pack(side=LEFT) controller.stop_button(frame, text="Stop").pack(side=LEFT) controller.step_button(frame, text="Step").pack(side=LEFT) controller.object_button(frame, text="Rock").pack(side=LEFT) controller.object_button(frame, text="Hunter").pack(side=LEFT) controller.object_button(frame, text="Remove").pack(side=LEFT) controller.progress(frame, text="0 updates/0 simultons", width=25, relief=RAISED).pack(side=LEFT) root.bind("<KeyPress-Up>", model.up_key) root.bind("<KeyPress-Right>", model.right_key) root.bind("<KeyPress-Left>", model.left_key) root.bind("<KeyPress-Down>", model.down_key) # Place canvas in the space below controller.simulation_canvas(root, width=500, height=500, bg="white").pack(side=BOTTOM, expand=True,
from tkinter import Tk, Frame, TOP, LEFT, BOTTOM, RAISED, BOTH import controller root = Tk() root.title("Covid-19 Simulator") root.protocol("WM_DELETE_WINDOW", quit) frame = Frame(root) frame.pack(side=TOP) controller.reset_button(frame, text="Reset").pack(side=LEFT) controller.start_button(frame, text="Start").pack(side=LEFT) controller.stop_button(frame, text="Stop").pack(side=LEFT) controller.step_button(frame, text="Step").pack(side=LEFT) controller.object_button(frame, text="Healthy Person").pack(side=LEFT) controller.object_button(frame, text="Moving Healthy Person").pack(side=LEFT) controller.object_button(frame, text="Infected Person").pack(side=LEFT) controller.object_button(frame, text="Moving Infected Person").pack(side=LEFT) controller.object_button(frame, text="Remove").pack(side=LEFT) controller.progress(frame, text="0 updates/ 0 Healthy/ 0 Infected/ 0 Recovered/ 0 Dead", width=50, relief=RAISED).pack(side=LEFT) controller.simulation_canvas(root, width=700, height=450, bg="white").pack(side=BOTTOM, expand=True, fill=BOTH)