Question: this is a python Program that me and my friends wrote, now we need a GUI in tkinter for this program. i tried to wirte

this is a python Program that me and my friends wrote, now we need a GUI in tkinter for this program.

i tried to wirte a GUI on my own, but im new to tkinter, so I'm out of ideas

PLEASE write a GUI in tkinter, and make sure that the program will be able to show and run in the GUI instead of in the shell.

THANK YOU!!!

this is a python Program that me and my friends wrote, nowwe need a GUI in tkinter for this program. i tried towirte a GUI on my own, but im new to tkinter, so

here's the text version

----------------------------------------------------------------------------------------------------------------------------------------------------------

class event:

data = []

name = "Base Event"

descriptions = []

def __init__(self,x,descriptions):

self.data = x

self.descriptions = descriptions

def get_raw_event(self):

print(self.data)

def set_data(self,new_data):

self.data = new_data

def get_event(self):

i = 0

printable_name = "-----Event Name: %s----- "%(self.name)

print(printable_name)

for i in range(len(self.data)):

print(self.descriptions[i][self.data[i]])

dashes = (len(printable_name)-1)*"-"

print(dashes)

print(" "," ")

class state:

name = "New State"

data = []# [Traveling mode, Turn, Car avoidance, Chasing, Course Selection, Lap count max]

descriptions = []

def __init__(self,data,name, descriptions):

self.data = data

self.name = name

self.descriptions = descriptions

def get_raw_state(self):

print(self.data)

def get_state(self):

i = 0

printable_name = "-----State Name: %s----- "%(self.name)

print(printable_name)

for i in range(len(self.data)-2):

print(self.descriptions[i][self.data[i]])

dashes = (len(printable_name)-1)*"-"

print(dashes)

def update_state(self,event):

string_event = ''.join(str(e) for e in event.data)

if string_event == "00000":

self.data = [0,0,0,0,0]

elif string_event == "10000":

self.data = [1,0,0,0,0]

elif string_event == "01010":

self.data = [2,0,0,0,0]

else:

self.data = [0,0,0,0,0]

test_descriptions = [["Car is ready", "Car is moving", "Car is finished"],

["Car is not turning", "Car is turning left", "Car is turning right"],

["Car is not avoiding", "Car is avoiding left car", "Car is avoiding right car"],

["Car is not chasing", "Car is chasing"],

["Normal course", "Shortcut Course"]]

event_descriptions = [["Red Light","Green Light"],

["Start Line","Both Lines","Only Left Line","Only Right line","Left Line Close", "Right Line Close"],

["No shortcut","Shortcut Entrance","Shortcut Exit"],

["Horizontal Line","Finish Line","Horizontal Line Right","Horizontal Line Left"],

["No Other Cars","Other Car Right","Other Car Left","Other Car Front"]]

def begin_menu(current_state,current_event):

choice = "default"

valid_choices = ["help", "show state template", "show event template", "input event", "quit"]

while choice.lower() != "quit":

choice = input("Type a command :")

if (choice.lower() == "help"):

print("Commands: Help | Show State Template | Show Event Template | Input Event | Quit ")

if (choice.lower() == "show event template"):

i = 0

while i

print(current_event.descriptions[i])

i+=1

print(" "," ")

if (choice.lower() == "show state template"):

i = 0

while i

print(current_state.descriptions[i])

i+=1

print(" "," ")

if (choice.lower() == "input event"):

current_input = input("New Event: ")

while len(current_input) != 5 or not current_input.isdigit():

print ("New event must be 5 characters long and all characters must be integers, type 'Show Event Template' for help ")

current_input = input("New Event: ")

print(" "," ")

temp_data = []

i = 0

while i

temp_data.append(int(current_input[i]))

i+=1

new_event = event(temp_data,event_descriptions)

old_event = current_event

current_event = new_event

current_state.update_state(current_event)

current_state.get_state()

current_event.get_event()

if (choice.lower() not in valid_choices):

print("Invalid command. Type 'help' to see all available commands. ")

current_state = state([0,0,0,0,0,0], "State",test_descriptions)

current_state.get_state()

current_event = event([0,0,0,0,0],event_descriptions)

begin_menu(current_state,current_event)

class event: data = [] name "Base Event" descriptions [1 def _init__(self,x, descriptions): self.datax def get_raw_event(self): def set_data(self,new_data): def get_event(self): self.descriptions descriptions print(self.data) self.datanew_data "%(self.name) printable-name-" Event Name : %s- print (printable_name) for i in range(len(self.data)): print(self.descriptions[i] [self.data[i]]) dashes (len(printable-name)-1)*"-" print(dashes) print(" ","In") class state: name"New State" data []# [Traveling mode, Turn, Car avoidance, Chasing, Course Selection, Lap count max) descriptions [1 def _init__(self, data,name, descriptions): self.datadata self.namename self.descriptions descriptions def get_raw_state(self): print(self.data) def get_state(self): "% (self, name) printable_name" print(printable_name) for i in range(len (self.data) -2): State Name : %s print(self.descriptions [i] [self.data[i]]) dashes (len (printable_name)-1)*"-" print(dashes) def update_state(self,event): string-event -...join(str(e) for e in event.data) if string_event"00000"; class event: data = [] name "Base Event" descriptions [1 def _init__(self,x, descriptions): self.datax def get_raw_event(self): def set_data(self,new_data): def get_event(self): self.descriptions descriptions print(self.data) self.datanew_data "%(self.name) printable-name-" Event Name : %s- print (printable_name) for i in range(len(self.data)): print(self.descriptions[i] [self.data[i]]) dashes (len(printable-name)-1)*"-" print(dashes) print(" ","In") class state: name"New State" data []# [Traveling mode, Turn, Car avoidance, Chasing, Course Selection, Lap count max) descriptions [1 def _init__(self, data,name, descriptions): self.datadata self.namename self.descriptions descriptions def get_raw_state(self): print(self.data) def get_state(self): "% (self, name) printable_name" print(printable_name) for i in range(len (self.data) -2): State Name : %s print(self.descriptions [i] [self.data[i]]) dashes (len (printable_name)-1)*"-" print(dashes) def update_state(self,event): string-event -...join(str(e) for e in event.data) if string_event"00000

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!