示例#1
0
    def __init__(this, data) -> None:
        ScrollableWindow.__init__(this, data)

        this.font_family = ConfigLoader.get("font-family")
        this.font_color = ConfigLoader.get("font-color")

        this.dao = AdDAO()
示例#2
0
    def __init__(this, data):
        Window.__init__(this, data)

        this.rowconfigure(index=0, weight=1)
        this.rowconfigure(index=1, weight=1)
        this.rowconfigure(index=2, weight=1)
        this.rowconfigure(index=3, weight=300)
        this.rowconfigure(index=4, weight=1)
        this.columnconfigure(index=0, weight=70)
        this.columnconfigure(index=1, weight=30)

        this.font_family = ConfigLoader.get("font-family")
        this.font_color = ConfigLoader.get("font-color")

        tkinter.Label(this, fg=this.font_color, bg=this['bg'], text="Hirdetés felvitele", font=(this.font_family, 25)).grid(row=0, column=0, columnspan=2)
        this.img = None
        this.filename = ""
        this.filename_label = tkinter.Label(this, fg=this.font_color, bg=this['bg'], text="Nincs feltöltött file", font=(this.font_family, 10))
        this.filename_label.grid(row=2, column=1, sticky="N")

        ttk.Button(this, command=this.upload_poster, text="Fájl feltöltés").grid(row=1, column=1)
        ttk.Button(this, command=this.go_back, text="Vissza").grid(row=4, column=0, sticky="E")
        ttk.Button(this, command=this.insert_ad, text="Felvitel").grid(row=4, column=1, sticky="W")

        this.title = tkinter.Entry(this, width=70)
        this.text = tkinter.Text(this, width=100, height=50)

        this.title.grid(row=1, column=0, rowspan=2)
        this.text.grid(row=3, column=0, columnspan=2)

        this.dao = AdDAO()

        this.reset()
示例#3
0
    def __init__(this, data) -> None:
        Window.__init__(this, data)

        this.dao = UserDAO()

        # TEMPORARY WEIGHTS
        this.rowconfigure(index=0, weight=4)
        this.rowconfigure(index=1, weight=1)
        this.rowconfigure(index=2, weight=1)
        this.rowconfigure(index=3, weight=3)
        this.columnconfigure(index=0, weight=1)
        this.columnconfigure(index=1, weight=1)

        this.uname_entry: Union[None, Entry] = None
        this.pwd_entry: Union[None, Entry] = None

        font_family = ConfigLoader.get("font-family")
        font_color = ConfigLoader.get("font-color")
        header_color = "gray7"

        # TITLE
        Label(this,
              text="Infoglaló",
              fg=font_color,
              bg=header_color,
              font=(font_family, 26)).grid(row=0,
                                           column=0,
                                           columnspan=2,
                                           sticky="NESW")

        # FIELD NAMES
        Label(this,
              text="Felhasználónév: ",
              fg=font_color,
              bg=this["bg"],
              font=font_family).grid(row=1, column=0, sticky="SE")
        Label(this,
              text="Jelszó: ",
              fg=font_color,
              bg=this["bg"],
              font=font_family).grid(row=2, column=0, sticky="NE")

        # INPUT FIELDS
        this.uname_entry = Entry(this)
        this.pwd_entry = Entry(this, show="*")

        this.uname_entry.grid(row=1, column=1, sticky="SW")
        this.pwd_entry.grid(row=2, column=1, sticky="NW")

        # BUTTONS
        Button(this, text="Regisztráció",
               command=this.go_to_register).grid(row=3, column=0, sticky="EN")
        Button(this, text="Bejelentkezés",
               command=this.login2).grid(row=3, column=1, sticky="WN")
示例#4
0
    def reset(this) -> None:
        font_family = ConfigLoader.get("font-family")
        font_color = ConfigLoader.get("font-color")

        #MENU TITLE
        tkinter.Label(this, text="Válassz játékmódot!", fg=font_color, bg=this["bg"], font=(font_family, 26)).grid(row=0, column=0, sticky="NESW")

        #MENU BUTTONS
        Button(this, command=this.go_to_iq, text="IQ teszt").grid(row=1, column=0)
        Button(this, command=this.go_to_comp, text="Verseny").grid(row=2, column=0)
        Button(this, command=this.go_to_duel, text="Párbaj").grid(row=3, column=0)
        Button(this, command=this.go_to_test, text="Tematikus teszt").grid(row=4, column=0)
        Button(this, command=this.go_back, text="Vissza").grid(row=6, column=0)
示例#5
0
    def __init__(this, data) -> None:
        Window.__init__(this, data)

        this.font_family = ConfigLoader.get("font-family")
        this.font_color = ConfigLoader.get("font-color")

        this.rowconfigure(index=0, weight=50)
        this.rowconfigure(index=1, weight=1)
        this.rowconfigure(index=2, weight=1)
        this.rowconfigure(index=3, weight=20)
        this.rowconfigure(index=4, weight=1)
        this.rowconfigure(index=5, weight=100)

        this.columnconfigure(index=0, weight=1)

        this.reset()
示例#6
0
    def __init__(this, data) -> None:
        ScrollableWindow.__init__(this, data)

        this.main_frame.rowconfigure(index=0, weight=50)
        this.main_frame.rowconfigure(index=1, weight=1)
        this.main_frame.rowconfigure(index=2, weight=10)
        this.main_frame.rowconfigure(index=3, weight=1)
        this.main_frame.rowconfigure(index=4, weight=20)
        this.main_frame.rowconfigure(index=5, weight=1)
        this.main_frame.rowconfigure(index=6, weight=100)
        this.main_frame.columnconfigure(index=0, weight=1)
        this.main_frame.columnconfigure(index=1, weight=1)
        this.main_frame.columnconfigure(index=2, weight=1)
        this.main_frame.columnconfigure(index=3, weight=1)

        this.aggregate_data: list[str] = list()
        this.easy_data: list[str] = list()
        this.medium_data: list[str] = list()
        this.hard_data: list[str] = list()

        this.display_box: Union[tkinter.Listbox, None] = None

        this.aggregate_label: Union[tkinter.Button, None] = None
        this.easy_label: Union[tkinter.Button, None] = None
        this.medium_label: Union[tkinter.Button, None] = None
        this.hard_label: Union[tkinter.Button, None] = None

        this.highlight_color = ConfigLoader.get("accent-color")

        this.dao = TopListDAO()
        this.reset()
示例#7
0
    def __init__(this, data) -> None:
        Window.__init__(this, data)

        this.font_family = ConfigLoader.get("font-family")
        this.font_color = ConfigLoader.get("font-color")

        this.rowconfigure(index=0, weight=30)
        this.rowconfigure(index=1, weight=20)
        this.rowconfigure(index=2, weight=30)
        this.rowconfigure(index=3, weight=1)
        this.rowconfigure(index=4, weight=20)
        this.columnconfigure(index=0, weight=1)
        this.columnconfigure(index=1, weight=1)

        tkinter.Label(this,
                      fg=this.font_color,
                      text="Statisztikák",
                      bg=this['bg'],
                      font=(this.font_family, 25)).grid(row=0,
                                                        column=0,
                                                        columnspan=2)

        tkinter.Label(this,
                      fg=this.font_color,
                      text="Összesített korosztályos statisztika",
                      bg=this['bg'],
                      font=(this.font_family, 18)).grid(row=1, column=0)

        tkinter.Label(this,
                      fg=this.font_color,
                      text=this.data["user"][0] +
                      " témakör szerinti statisztikája",
                      bg=this['bg'],
                      font=(this.font_family, 18)).grid(row=1, column=1)

        ttk.Button(this, text="Mutat",
                   command=this.show_ages_stat).grid(row=2,
                                                     column=0,
                                                     sticky="N")
        ttk.Button(this, text="Mutat",
                   command=this.show_theme_stat).grid(row=2,
                                                      column=1,
                                                      sticky="N")

        ttk.Button(this, text="Vissza", command=this.go_back).grid(row=3,
                                                                   column=0)
示例#8
0
文件: app.py 项目: leopph/infoglalo
    def __init__(this, *args, **kwargs):
        tkinter.Tk.__init__(this, *args, **kwargs)

        this.geometry(ConfigLoader.get("default-size"))
        this.minsize(800, 600)
        this["bg"] = ConfigLoader.get("background-color")

        # CACHE FOR LOADED WINDOWS
        this.windows: dict[Type[Window], Window] = dict()
        # WINDOW BACK STACK
        this.back_stack: list[Window] = list()

        # CENTRAL DATA HOLDER
        this.data: dict[str] = dict()

        this.title(ConfigLoader.get("window-title"))

        this.columnconfigure(index=0, weight=1)
        this.rowconfigure(index=0, weight=1)

        this.raise_window(LoginWindow)
示例#9
0
    def reset(this) -> None:
        font_family = ConfigLoader.get("font-family")
        font_color = ConfigLoader.get("font-color")

        #MENU TITLE
        tkinter.Label(this,
                      text="Üdv, " + this.data["user"][0] + "!",
                      fg=font_color,
                      bg=this["bg"],
                      font=(font_family, 26)).grid(row=0, column=0)

        #MENU BUTTONS
        Button(this, command=this.go_to_play, text="Játék").grid(row=1,
                                                                 column=0)
        Button(this, command=this.go_to_ranking, text="Rangsor").grid(row=2,
                                                                      column=0)
        Button(this, command=this.go_to_social,
               text="Közösségi").grid(row=3, column=0)
        Button(this, command=this.go_to_ad, text="Hirdetések").grid(row=4,
                                                                    column=0)
        Button(this, command=this.go_to_stat,
               text="Statisztika").grid(row=5, column=0)
        Button(this, command=this.logout, text="Kijelentkezés").grid(row=7,
                                                                     column=0)
示例#10
0
    def __init__(this, data) -> None:
        Window.__init__(this, data)

        this.dao = DuelDAO()
        this.c_dao = CompDAO()

        font_color = ConfigLoader.get("font-color")
        font_family = ConfigLoader.get("font-family")
        this.accent_color = ConfigLoader.get("accent-color")

        tkinter.Label(master=this,
                      fg=font_color,
                      bg=this["bg"],
                      font=(font_family, 26),
                      text="Verseny").pack(side=tkinter.TOP, fill=tkinter.X)

        this.question_label = tkinter.Label(master=this,
                                            fg=font_color,
                                            bg=this["bg"],
                                            font=(font_family, 20))

        this.answers_frame = tkinter.Frame(master=this, bg=this["bg"])

        for i in range(2):
            this.answers_frame.rowconfigure(index=i, weight=1)
            this.answers_frame.columnconfigure(index=i, weight=1)

        this.ans_a_label = tkinter.Label(master=this.answers_frame,
                                         fg=font_color,
                                         bg=this["bg"],
                                         font=(font_family, 16))
        this.ans_b_label = tkinter.Label(master=this.answers_frame,
                                         fg=font_color,
                                         bg=this["bg"],
                                         font=(font_family, 16))
        this.ans_c_label = tkinter.Label(master=this.answers_frame,
                                         fg=font_color,
                                         bg=this["bg"],
                                         font=(font_family, 16))
        this.ans_d_label = tkinter.Label(master=this.answers_frame,
                                         fg=font_color,
                                         bg=this["bg"],
                                         font=(font_family, 16))

        this.ans_a_label.grid(row=0, column=0, padx=(0, 30))
        this.ans_b_label.grid(row=0, column=1, padx=(30, 0))
        this.ans_c_label.grid(row=1, column=0, padx=(0, 30))
        this.ans_d_label.grid(row=1, column=1, padx=(30, 0))

        this.ans_a_label.bind("<Button-1>", lambda e: this.on_selected("a"))
        this.ans_b_label.bind("<Button-1>", lambda e: this.on_selected("b"))
        this.ans_c_label.bind("<Button-1>", lambda e: this.on_selected("c"))
        this.ans_d_label.bind("<Button-1>", lambda e: this.on_selected("d"))

        this.ans_a_label.bind("<Enter>",
                              lambda e: this.on_mouse_enter(this.ans_a_label))
        this.ans_b_label.bind("<Enter>",
                              lambda e: this.on_mouse_enter(this.ans_b_label))
        this.ans_c_label.bind("<Enter>",
                              lambda e: this.on_mouse_enter(this.ans_c_label))
        this.ans_d_label.bind("<Enter>",
                              lambda e: this.on_mouse_enter(this.ans_d_label))

        this.ans_a_label.bind("<Leave>",
                              lambda e: this.on_mouse_leave(this.ans_a_label))
        this.ans_b_label.bind("<Leave>",
                              lambda e: this.on_mouse_leave(this.ans_b_label))
        this.ans_c_label.bind("<Leave>",
                              lambda e: this.on_mouse_leave(this.ans_c_label))
        this.ans_d_label.bind("<Leave>",
                              lambda e: this.on_mouse_leave(this.ans_d_label))

        this.result_frame = tkinter.Frame(master=this, bg=this["bg"])
        this.correctness_label = tkinter.Label(master=this.result_frame,
                                               fg=font_color,
                                               bg=this["bg"],
                                               font=(font_family, 20))
        this.result_label = tkinter.Label(master=this.result_frame,
                                          fg=font_color,
                                          bg=this["bg"],
                                          font=(font_family, 14))
        tkinter.ttk.Button(master=this.result_frame,
                           text="Vissza",
                           command=this.go_back).pack(side=tkinter.BOTTOM)

        this.correctness_label.pack()
        this.result_label.pack()
示例#11
0
    def __init__(this, data):
        Window.__init__(this, data)

        this.selected = ""

        this.dao = CompDAO()

        this.data["in_game"] = dict()

        this.rowconfigure(index=0, weight=50)
        this.rowconfigure(index=1, weight=1)
        this.rowconfigure(index=2, weight=1)
        this.rowconfigure(index=3, weight=1)
        this.rowconfigure(index=4, weight=20)
        this.rowconfigure(index=5, weight=1)
        this.rowconfigure(index=6, weight=1)
        this.rowconfigure(index=7, weight=100)
        this.columnconfigure(index=0, weight=1)
        this.columnconfigure(index=1, weight=1)
        this.columnconfigure(index=2, weight=1)
        this.columnconfigure(index=3, weight=1)
        this.columnconfigure(index=4, weight=1)
        this.columnconfigure(index=5, weight=1)

        this.font_family = ConfigLoader.get("font-family")
        this.font_color = ConfigLoader.get("font-color")
        this.highlight_color = ConfigLoader.get("accent-color")

        tkinter.Label(this,
                      font=(this.font_family, 26),
                      fg=this.font_color,
                      bg=this["bg"],
                      text="Verseny").grid(row=0,
                                           column=0,
                                           columnspan=6,
                                           sticky="NEWS")
        tkinter.Label(this,
                      font=(this.font_family, 18),
                      fg=this.font_color,
                      bg=this["bg"],
                      text="Versenyek").grid(row=1, column=0, columnspan=2)
        tkinter.Label(this,
                      font=(this.font_family, 18),
                      fg=this.font_color,
                      bg=this["bg"],
                      text="Verseny jelentkezesek").grid(row=1,
                                                         column=2,
                                                         columnspan=2)
        tkinter.Label(this,
                      font=(this.font_family, 18),
                      fg=this.font_color,
                      bg=this["bg"],
                      text="Aktiv utkozetek").grid(row=1,
                                                   column=4,
                                                   columnspan=2)

        this.all_comp = tkinter.Listbox(this,
                                        font=this.font_family,
                                        fg=this.font_color,
                                        bg=this["bg"],
                                        bd=0,
                                        selectbackground=this.highlight_color,
                                        highlightthickness=0,
                                        relief=tkinter.FLAT,
                                        selectmode=tkinter.SINGLE)
        this.my_comp = tkinter.Listbox(this,
                                       font=this.font_family,
                                       fg=this.font_color,
                                       bg=this["bg"],
                                       bd=0,
                                       selectbackground=this.highlight_color,
                                       highlightthickness=0,
                                       relief=tkinter.FLAT,
                                       selectmode=tkinter.SINGLE)
        this.akt_play = tkinter.Listbox(this,
                                        font=this.font_family,
                                        fg=this.font_color,
                                        bg=this["bg"],
                                        bd=0,
                                        selectbackground=this.highlight_color,
                                        highlightthickness=0,
                                        relief=tkinter.FLAT,
                                        selectmode=tkinter.SINGLE)

        this.all_comp.grid(row=2, column=0, columnspan=2, sticky="NESW")
        this.my_comp.grid(row=2, column=2, columnspan=2, sticky="NESW")
        this.akt_play.grid(row=2, column=4, columnspan=2, sticky="NESW")

        this.all_comp.config(justify=tkinter.CENTER, activestyle="none")
        this.my_comp.config(justify=tkinter.CENTER, activestyle="none")
        this.akt_play.config(justify=tkinter.CENTER, activestyle="none")

        ap_button = Button(this, text="Jelentkezes", command=this.join_comp)
        ap_button.grid(row=3, column=0, columnspan=2)

        start_button = Button(this,
                              text="Verseny inditas",
                              command=this.start_comp)
        start_button.grid(row=3, column=2, columnspan=2)

        start_play = Button(this,
                            text="Utkozet inditas",
                            command=this.start_play)
        start_play.grid(row=3, column=4, columnspan=2)

        this.all_comp.buttons = [ap_button]
        this.my_comp.buttons = [start_button]
        this.akt_play.buttons = [start_play]

        Button(this, text="Vissza", command=this.go_back).grid(row=5,
                                                               column=0,
                                                               columnspan=6)
        if this.data["user"][4]:
            Button(this, text="Uj verseny",
                   command=this.make_new).grid(row=6, column=0, columnspan=6)
示例#12
0
    def reset(this) -> None:

        font_family = ConfigLoader.get("font-family")
        font_color = ConfigLoader.get("font-color")
        std_font_size = 12

        tkinter.Label(this,
                      text="Regisztráció",
                      fg=font_color,
                      bg=this["bg"],
                      font=(font_family, 26)).grid(row=0,
                                                   column=0,
                                                   columnspan=2,
                                                   sticky="NESW")
        tkinter.Label(this,
                      text="Felhasználónév",
                      fg=font_color,
                      bg=this["bg"],
                      font=(font_family, std_font_size)).grid(row=1,
                                                              column=0,
                                                              sticky="E")
        tkinter.Label(this,
                      text="Jelszó",
                      fg=font_color,
                      bg=this["bg"],
                      font=(font_family, std_font_size)).grid(row=2,
                                                              column=0,
                                                              sticky="E")
        tkinter.Label(this,
                      text="Jelszó újra",
                      fg=font_color,
                      bg=this["bg"],
                      font=(font_family, std_font_size)).grid(row=3,
                                                              column=0,
                                                              sticky="E")
        tkinter.Label(this,
                      text="Email",
                      fg=font_color,
                      bg=this["bg"],
                      font=(font_family, std_font_size)).grid(row=4,
                                                              column=0,
                                                              sticky="E")
        Button(this, command=this.get_date,
               text="Születési dátum").grid(row=5, column=0, sticky="E")

        this.uname_entry = Entry(this)
        this.pwd_entry = Entry(this, show="*")
        this.apwd_entry = Entry(this, show="*")
        this.email_entry = Entry(this)
        this.birthdate_entry = Entry(this)

        this.uname_entry.grid(row=1, column=1, sticky="W")
        this.pwd_entry.grid(row=2, column=1, sticky="W")
        this.apwd_entry.grid(row=3, column=1, sticky="W")
        this.email_entry.grid(row=4, column=1, sticky="W")
        this.birthdate_entry.grid(row=5, column=1, sticky="W")
        this.birthdate_entry.config(state="disabled")

        Button(this, command=this.go_to_login,
               text="Bejelentkezés").grid(row=7, column=0, sticky="E")
        Button(this, command=this.regist, text="Regisztráció").grid(row=7,
                                                                    column=1,
                                                                    sticky="W")
示例#13
0
    def __init__(this, data) -> None:
        Window.__init__(this, data)

        this.dao = IQDAO()
        this.data["iq"] = dict()


        this.question_index = 0
        this.num_max_questions = 5
        this.given_answers: list[bool] = list()

        font_color = ConfigLoader.get("font-color")
        font_family = ConfigLoader.get("font-family")
        this.accent_color = ConfigLoader.get("accent-color")

        tkinter.Label(master=this, fg=font_color, bg=this["bg"], font=(font_family, 26), text="IQ teszt").pack(
            side=tkinter.TOP, fill=tkinter.X)

        # ACTUAL GAME SCREEN
        this.game_frame = tkinter.Frame(this, bg=this["bg"])
        this.question_label = tkinter.Label(this.game_frame, font=(font_family, 15), fg=font_color, bg=this["bg"],  wraplength=600)
        this.answers_frame = tkinter.Frame(this.game_frame, bg=this["bg"])

        this.question_label.pack()
        this.answers_frame.pack()

        for i in range(2):
            this.answers_frame.rowconfigure(index=i, weight=1)
            this.answers_frame.columnconfigure(index=i, weight=1)

        this.ans_a_label = tkinter.Label(master=this.answers_frame, fg=font_color, bg=this["bg"],
                                         font=(font_family, 16))
        this.ans_b_label = tkinter.Label(master=this.answers_frame, fg=font_color, bg=this["bg"],
                                         font=(font_family, 16))
        this.ans_c_label = tkinter.Label(master=this.answers_frame, fg=font_color, bg=this["bg"],
                                         font=(font_family, 16))
        this.ans_d_label = tkinter.Label(master=this.answers_frame, fg=font_color, bg=this["bg"],
                                         font=(font_family, 16))

        this.ans_a_label.grid(row=0, column=0, padx=(0, 30))
        this.ans_b_label.grid(row=0, column=1, padx=(30, 0))
        this.ans_c_label.grid(row=1, column=0, padx=(0, 30))
        this.ans_d_label.grid(row=1, column=1, padx=(30, 0))

        this.ans_a_label.bind("<Button-1>", lambda e: this.on_answer_selected("a"))
        this.ans_b_label.bind("<Button-1>", lambda e: this.on_answer_selected("b"))
        this.ans_c_label.bind("<Button-1>", lambda e: this.on_answer_selected("c"))
        this.ans_d_label.bind("<Button-1>", lambda e: this.on_answer_selected("d"))

        this.ans_a_label.bind("<Enter>", lambda e: this.on_mouse_enter(this.ans_a_label))
        this.ans_b_label.bind("<Enter>", lambda e: this.on_mouse_enter(this.ans_b_label))
        this.ans_c_label.bind("<Enter>", lambda e: this.on_mouse_enter(this.ans_c_label))
        this.ans_d_label.bind("<Enter>", lambda e: this.on_mouse_enter(this.ans_d_label))

        this.ans_a_label.bind("<Leave>", lambda e: this.on_mouse_leave(this.ans_a_label))
        this.ans_b_label.bind("<Leave>", lambda e: this.on_mouse_leave(this.ans_b_label))
        this.ans_c_label.bind("<Leave>", lambda e: this.on_mouse_leave(this.ans_c_label))
        this.ans_d_label.bind("<Leave>", lambda e: this.on_mouse_leave(this.ans_d_label))

        # RESULTS SCREEN
        this.results_frame = tkinter.Frame(this, bg=this["bg"])
        tkinter.Label(this.results_frame, fg=font_color, font=(font_family, 26), bg=this["bg"],
                      text="Eredmények").pack()

        this.answer_correctness_labels: list[tkinter.Label] = list()

        for i in range(this.num_max_questions):
            this.answer_correctness_labels.append(
                tkinter.Label(this.results_frame, bg=this["bg"], fg=font_color, font=(font_family, 20)))
            this.answer_correctness_labels[-1].pack()

        this.iq_level_label = tkinter.Label(this.results_frame, bg=this["bg"], fg=font_color, font=(font_family, 20))
        this.iq_level_label.pack()
        tkinter.ttk.Button(master=this.results_frame, command=this.go_back, text="Vissza").pack()

        this.start()
示例#14
0
    def reset(this) -> None:
        for child in this.main_frame.winfo_children():
            child.destroy()

        this.aggregate_data, this.easy_data, this.medium_data, this.hard_data = this.query_info(
        )

        font_family = ConfigLoader.get("font-family")
        font_color = ConfigLoader.get("font-color")

        tkinter.Label(this.main_frame,
                      font=(font_family, 26),
                      fg=font_color,
                      bg=this["bg"],
                      text="Rangsor").grid(row=0,
                                           column=0,
                                           columnspan=4,
                                           sticky="NESW")

        this.aggregate_label = tkinter.Label(this.main_frame,
                                             font=(font_family, 20),
                                             fg=font_color,
                                             bg=this["bg"],
                                             text="Összesített")
        this.easy_label = tkinter.Label(this.main_frame,
                                        font=(font_family, 20),
                                        fg=font_color,
                                        bg=this["bg"],
                                        text="Könnyű")
        this.medium_label = tkinter.Label(this.main_frame,
                                          font=(font_family, 20),
                                          fg=font_color,
                                          bg=this["bg"],
                                          text="Közepes")
        this.hard_label = tkinter.Label(this.main_frame,
                                        font=(font_family, 20),
                                        fg=font_color,
                                        bg=this["bg"],
                                        text="Nehéz")

        this.aggregate_label.grid(row=1, column=0)
        this.easy_label.grid(row=1, column=1)
        this.medium_label.grid(row=1, column=2)
        this.hard_label.grid(row=1, column=3)

        this.aggregate_label.bind(
            "<Button-1>", lambda e: this.swap_list(this.aggregate_data, this.
                                                   aggregate_label))
        this.easy_label.bind(
            "<Button-1>",
            lambda e: this.swap_list(this.easy_data, this.easy_label))
        this.medium_label.bind(
            "<Button-1>",
            lambda e: this.swap_list(this.medium_data, this.medium_label))
        this.hard_label.bind(
            "<Button-1>",
            lambda e: this.swap_list(this.hard_data, this.hard_label))

        this.aggregate_label.config(relief=tkinter.FLAT,
                                    activebackground=this.highlight_color)
        this.easy_label.config(relief=tkinter.FLAT,
                               activebackground=this.highlight_color)
        this.medium_label.config(relief=tkinter.FLAT,
                                 activebackground=this.highlight_color)
        this.hard_label.config(relief=tkinter.FLAT,
                               activebackground=this.highlight_color)

        this.display_box = tkinter.Listbox(this.main_frame,
                                           font=font_family,
                                           fg=font_color,
                                           bg=this["bg"],
                                           bd=0,
                                           highlightthickness=0,
                                           relief=tkinter.FLAT,
                                           selectmode=tkinter.SINGLE,
                                           justify=tkinter.CENTER,
                                           activestyle=tkinter.NONE,
                                           selectbackground=this["bg"])
        this.display_box.grid(row=3, column=0, columnspan=4, sticky="NESW")

        Button(this.main_frame, command=this.go_back,
               text="Vissza").grid(row=5, column=1, columnspan=2)

        this.swap_list(this.aggregate_data, this.aggregate_label)
示例#15
0
    def __init__(this, data) -> None:
        Window.__init__(this, data)

        font_color = ConfigLoader.get("font-color")
        font_family = ConfigLoader.get("font-family")
        this.accent_color = ConfigLoader.get("accent-color")


        this.dao = TestDAO()
        this.data["test"] = dict()
        this.data["test"]["categories"]: list[str] = list()
        this.data["test"]["difficulties"]: dict[str, int] = {
            "Könnyű": 0,
            "Közepes": 1,
            "Nehéz": 2
        }

        # THIS REFERS TO THE CURRENT QUESTION
        this.question_index = 0
        this.num_max_questions = 3


        # STORE ANSWER CORRECTNESS
        this.given_answers: list[bool] = list()


        # INITIAL SETUP SCREEN
        this.setup_frame = tkinter.Frame(this, bg=this["bg"])

        tkinter.Label(master=this.setup_frame, bg=this["bg"], fg=font_color, font=(font_family, 26), text="Válassz témakört és nehézséget!").pack(pady=(50, 0))

        this.current_category = tkinter.StringVar(this.setup_frame)
        this.category_menu = tkinter.ttk.Combobox(this.setup_frame, state="readonly", textvariable=this.current_category)
        this.category_menu.pack(pady=(25, 0))

        this.current_difficulty = tkinter.StringVar(this.setup_frame)
        this.difficulty_menu = tkinter.ttk.Combobox(this.setup_frame, state="readonly", textvariable=this.current_difficulty, values=list(this.data["test"]["difficulties"]))
        this.difficulty_menu.pack()

        tkinter.ttk.Button(master=this.setup_frame, command=this.on_options_selected, text="Kezdés").pack(pady=(25, 0))
        tkinter.ttk.Button(master=this.setup_frame, command=this.go_back, text="Vissza").pack(pady=(5, 0))


        # ACTUAL GAME SCREEN
        this.game_frame = tkinter.Frame(this, bg=this["bg"])
        this.question_no_label = tkinter.Label(this.game_frame, font=(font_family, 26), fg=font_color, bg=this["bg"])
        this.question_label = tkinter.Label(this.game_frame, font=(font_family, 24, tkinter.UNDERLINE), fg=font_color, bg=this["bg"])
        this.answers_frame = tkinter.Frame(this.game_frame, bg=this["bg"])

        this.question_no_label.pack(pady=(50, 0))
        this.question_label.pack(pady=(15, 0))
        this.answers_frame.pack(pady=(15, 0))

        for i in range(2):
            this.answers_frame.rowconfigure(i, weight=1)
            this.answers_frame.columnconfigure(i, weight=1)

        this.ans_a_label = tkinter.Label(this.answers_frame, bg=this["bg"], fg=font_color, font=(font_family, 20))
        this.ans_b_label = tkinter.Label(this.answers_frame, bg=this["bg"], fg=font_color, font=(font_family, 20))
        this.ans_c_label = tkinter.Label(this.answers_frame, bg=this["bg"], fg=font_color, font=(font_family, 20))
        this.ans_d_label = tkinter.Label(this.answers_frame, bg=this["bg"], fg=font_color, font=(font_family, 20))

        this.ans_a_label.grid(row=0, column=0, padx=(0, 10))
        this.ans_b_label.grid(row=0, column=1, padx=(10, 0))
        this.ans_c_label.grid(row=1, column=0, padx=(0, 10), pady=(10, 0))
        this.ans_d_label.grid(row=1, column=1, padx=(10, 0), pady=(10, 0))

        this.ans_a_label.bind("<Button-1>", lambda e: this.on_answer_selected('a'))
        this.ans_b_label.bind("<Button-1>", lambda e: this.on_answer_selected('b'))
        this.ans_c_label.bind("<Button-1>", lambda e: this.on_answer_selected('c'))
        this.ans_d_label.bind("<Button-1>", lambda e: this.on_answer_selected('d'))

        this.ans_a_label.bind("<Enter>", lambda e: this.on_mouse_enter(this.ans_a_label))
        this.ans_b_label.bind("<Enter>", lambda e: this.on_mouse_enter(this.ans_b_label))
        this.ans_c_label.bind("<Enter>", lambda e: this.on_mouse_enter(this.ans_c_label))
        this.ans_d_label.bind("<Enter>", lambda e: this.on_mouse_enter(this.ans_d_label))

        this.ans_a_label.bind("<Leave>", lambda e: this.on_mouse_leave(this.ans_a_label))
        this.ans_b_label.bind("<Leave>", lambda e: this.on_mouse_leave(this.ans_b_label))
        this.ans_c_label.bind("<Leave>", lambda e: this.on_mouse_leave(this.ans_c_label))
        this.ans_d_label.bind("<Leave>", lambda e: this.on_mouse_leave(this.ans_d_label))


        # RESULTS SCREEN
        this.results_frame = tkinter.Frame(this, bg=this["bg"])
        tkinter.Label(this.results_frame, fg=font_color, font=(font_family, 26), bg=this["bg"], text="Eredmények").pack()

        this.answer_correctness_labels: list[tkinter.Label] = list()

        for i in range(this.num_max_questions):
            this.answer_correctness_labels.append(tkinter.Label(this.results_frame, bg=this["bg"], fg=font_color, font=(font_family, 20)))
            this.answer_correctness_labels[-1].pack()

        tkinter.ttk.Button(master=this.results_frame, command=this.go_back, text="Vissza").pack()
示例#16
0
    def __init__(this, data):
        Window.__init__(this, data)

        this.dao = DuelDAO()

        this.rowconfigure(index=0, weight=50)
        this.rowconfigure(index=1, weight=1)
        this.rowconfigure(index=2, weight=1)
        this.rowconfigure(index=3, weight=1)
        this.rowconfigure(index=4, weight=20)
        this.rowconfigure(index=5, weight=1)
        this.rowconfigure(index=6, weight=100)
        this.columnconfigure(index=0, weight=1)
        this.columnconfigure(index=1, weight=1)
        this.columnconfigure(index=2, weight=1)
        this.columnconfigure(index=3, weight=1)
        this.columnconfigure(index=4, weight=1)
        this.columnconfigure(index=5, weight=1)

        font_family = ConfigLoader.get("font-family")
        font_color = ConfigLoader.get("font-color")
        highlight_color = ConfigLoader.get("accent-color")

        tkinter.Label(this,
                      font=(font_family, 26),
                      fg=font_color,
                      bg=this["bg"],
                      text="Párbaj").grid(row=0,
                                          column=0,
                                          columnspan=6,
                                          sticky="NEWS")
        tkinter.Label(this,
                      font=(font_family, 18),
                      fg=font_color,
                      bg=this["bg"],
                      text="Kihívottjaid").grid(row=1, column=0, columnspan=2)
        tkinter.Label(this,
                      font=(font_family, 18),
                      fg=font_color,
                      bg=this["bg"],
                      text="Elérhetőek").grid(row=1, column=2, columnspan=2)
        tkinter.Label(this,
                      font=(font_family, 18),
                      fg=font_color,
                      bg=this["bg"],
                      text="Kihívóid").grid(row=1, column=4, columnspan=2)

        this.sent_requests = tkinter.Listbox(this,
                                             font=font_family,
                                             fg=font_color,
                                             bg=this["bg"],
                                             bd=0,
                                             selectbackground=highlight_color,
                                             highlightthickness=0,
                                             relief=tkinter.FLAT,
                                             selectmode=tkinter.SINGLE)
        this.player_list = tkinter.Listbox(this,
                                           font=font_family,
                                           fg=font_color,
                                           bg=this["bg"],
                                           bd=0,
                                           selectbackground=highlight_color,
                                           highlightthickness=0,
                                           relief=tkinter.FLAT,
                                           selectmode=tkinter.SINGLE)
        this.incoming_requests = tkinter.Listbox(
            this,
            font=font_family,
            fg=font_color,
            bg=this["bg"],
            bd=0,
            selectbackground=highlight_color,
            highlightthickness=0,
            relief=tkinter.FLAT,
            selectmode=tkinter.SINGLE)

        this.sent_requests.grid(row=2, column=0, columnspan=2, sticky="NESW")
        this.player_list.grid(row=2, column=2, columnspan=2, sticky="NESW")
        this.incoming_requests.grid(row=2,
                                    column=4,
                                    columnspan=2,
                                    sticky="NESW")

        this.sent_requests.config(justify=tkinter.CENTER, activestyle="none")
        this.player_list.config(justify=tkinter.CENTER, activestyle="none")
        this.incoming_requests.config(justify=tkinter.CENTER,
                                      activestyle="none")

        # TODO this clears selection before button could query, need another solution
        #this.sent_requests.bind('<FocusOut>', this.deselect_callback)
        #this.player_list.bind('<FocusOut>', this.deselect_callback)
        #this.incoming_requests.bind('<FocusOut>', this.deselect_callback)

        #this.sent_requests.bind('<FocusIn>', this.selection_callback)
        #this.player_list.bind('<FocusIn>', this.selection_callback)
        #this.incoming_requests.bind('<FocusIn>', this.selection_callback)

        revoke_button = Button(this, text="Visszavon", command=this.revoke)
        revoke_button.grid(row=3, column=0, columnspan=2)

        challenge_button = Button(this, text="Kihív", command=this.challenge)
        challenge_button.grid(row=3, column=2, columnspan=2)

        decline_button = Button(this, text="Elutasít", command=this.decline)
        decline_button.grid(row=3, column=4, sticky="E")

        accept_button = Button(this, text="Elfogad", command=this.accept)
        accept_button.grid(row=3, column=5, sticky="W")

        this.sent_requests.buttons = [revoke_button]
        this.player_list.buttons = [challenge_button]
        this.incoming_requests.buttons = [decline_button, accept_button]

        Button(this, text="Vissza", command=this.go_back).grid(row=5,
                                                               column=0,
                                                               columnspan=6)