CDT-1D / main.py
main.py
Raw
import char_screen
import topic_screen
import qn_screen
from timer_countdown import countdown
from copy import deepcopy
from tkinter import *
from initialise import *
import perk_screen
import end_screen


in_game = True
is_alive = True
root = Tk()
root.eval('tk::PlaceWindow . center')
stat = deepcopy(char_stat_dict)  #referencing the dictionary of dictionaries of the stats
print(stat[starting_char[0]])


#setting the frame for timer
timer_frame = Frame(root)
root.geometry('1400x800+300+100')

timer_frame.grid()
timer_frame.tk.call('tk', 'scaling', 2.5)


while in_game:
    while is_alive:
        # Check what to update
        if update_value_dict["char"] == True:
            char_screen.update_chara(stat[starting_char[0]])
        elif update_value_dict["perks"] == True:
            perk_screen.update_perks(stat[starting_char[0]])
        elif update_value_dict["end"] == True:
            end_screen.update_end(stat)
            #clearing all existing data and recreating them again
            stat.clear()
            print(stat)
            question_chosen.clear()
            stat = deepcopy(char_stat_dict)
            print(question_answer)
            print('hello')

            #checks if char_stat_dict was copied properly
            print(stat)


        # Check what to call
        if call_value_dict["char"] == True:
            char_screen.call_chara(root, stat[starting_char[0]])
        elif call_value_dict["topic"] == True:
            topic_screen.call_topic(root, stat[starting_char[0]])
        elif call_value_dict["question"] == True:
            qn_screen.call_question(root, stat[starting_char[0]])
        elif call_value_dict["perks"] == True:
            perk_screen.call_perks(root, stat[starting_char[0]])
        elif call_value_dict["end"] == True:
            end_screen.call_end(root, stat[starting_char[0]])

        root.update_idletasks()
        root.update()
        countdown()
        timer_display = Label(timer_frame, text=f"TIME: {int(timer_time[0])}")
        timer_display.grid(row=1, column=1)