def summonWindow0():
    window.title("Lazy DSi file Downloader")
    window.resizable(0,0)
    window.geometry("500x360")
    window.option_add("*Background", backgroundColour)
    window.configure(bg=backgroundColour)
    topFrame = tkinter.Frame(window)
    topFrame.pack(expand=True, fill=tkinter.BOTH,padx=5)
    topFrame.option_add("*Background", backgroundColour)
    bottomFrame = tkinter.Frame(window)
    bottomFrame.pack(side=tkinter.BOTTOM, fill=tkinter.X,padx=5)
    bottomFrame.option_add("*Background", backgroundColour)
    first = tkinter.Label(topFrame, text="Welcome to the Lazy DSi File Downloader", font=(titleFont), fg=foregroundColour)
    first.grid(column=0,row=0, sticky="w",padx=5)
    
    bulletpoints = [
        "This is an application made by Your Kalamity that downloads and place files for homebrew'ing your Nintendo DSi in the correct location. If you have already installed homebrew, this can also update the one you have.",
        "This is to be used in conjunction with the Nintendo DSi Modding guide by NightScript and emiyl",
        "Check it out here: https://dsi.cfw.guide/",
        "By using this application, you do not need to follow any of the 'Preparing SD card' steps.",
        "This application is to be given for free. If you have paid to receive this, contact the person that sold you this application; you have been scammed.",
        "You may use any part of this application for your own purposes as long as credit is given.",
        "Please proceed by hitting the 'Next' button"
        ]
    
    for count, x in enumerate(bulletpoints):
        bullet = tkinter.Label(topFrame, text=x, font=(paragraphFont),fg=foregroundColour,wraplength=450, justify="left")
        bullet.grid(column=0,row=count+3, sticky="w", padx=5)
    
    discordButton = Button(bottomFrame, text="DS⁽ⁱ⁾ Mode Hacking Discord server", fg=foregroundColour,bg=buttonColour, font=(buttonFont),command=lambda:webbrowser.open("https://discord.gg/yD3spjv",new=1))
    discordButton.pack(side=tkinter.LEFT, padx="5", pady="5")
    nextButton = Button(bottomFrame, text="Next",width=button_width, fg=foregroundColour,bg=nextButtonColour, font=(buttonFont),command=lambda:[topFrame.destroy(),bottomFrame.destroy(),summonWindow1()])
    nextButton.pack(side=tkinter.RIGHT, padx=5, pady=5)

    window.protocol("WM_DELETE_WINDOW",lambda:closeButtonPress(window))
Esempio n. 2
0
    def popup_rules(self):
        """Creates 'Rules' button in bottom right of screen, click it opens a popup window with the rules and an 'Okay'
        button to close the window and return to the game."""
        # Toplevel instead of Tk for secondary windows, you can only have one instance of Tk which is your main.
        popup = Toplevel(bg=self.background_color)
        popup.wm_title('Rules')
        popup_text = "Welcome to Numsum!\n" \
                     "The goal is to make a sum of 15 using exactly 3 numbers.\n" \
                     "When a number is chosen by one player, it becomes unavailable to choose for the other player.\n" \
                     "If all the numbers are selected and neither player can make a sum of 15, the game is a draw.\n" \
                     "Good Luck!"
        popup_label = Label(popup,
                            text=popup_text,
                            font=[self.font, 15],
                            bg=self.background_color,
                            fg=self.text_color,
                            justify='center')
        popup_label.pack()

        # .destroy will close that window
        confirm_button = Button(popup,
                                text='Okay',
                                bg=self.button_color,
                                fg=self.text_color,
                                font=[self.font, 15],
                                command=popup.destroy)
        confirm_button.pack()
        popup.mainloop()
def summonWindow2():

    topFrame = tkinter.Frame(window)
    topFrame.pack(expand=True, fill=tkinter.BOTH,padx=5)
    topFrame.option_add("*Background", backgroundColour)
    bottomFrame = tkinter.Frame(window)
    bottomFrame.pack(side=tkinter.BOTTOM, fill=tkinter.X,padx=5)
    bottomFrame.option_add("*Background", backgroundColour)
    first = tkinter.Label(topFrame, text="Homebrew Section", font=(titleFont), fg=foregroundColour)
    first.grid(column=0,row=0, sticky="w")
    subtitle = tkinter.Label(topFrame, text='brewed at home', font=(subtitleFont), fg=foregroundColour)
    subtitle.grid(column=0,row=1,sticky="w")
    downloadtwlmenuCheck = tkinter.Checkbutton(topFrame, text = "Download latest TWiLight Menu++ version?",fg=foregroundColour, variable = downloadtwlmenu,font=(buttonFont))
    downloadtwlmenuCheck.grid(column=0,row=2, sticky ="w")
    downloaddumptoolCheck = tkinter.Checkbutton(topFrame, text ="Download latest dumpTool version?", variable=downloaddumptool,fg=foregroundColour,font=(buttonFont))
    downloaddumptoolCheck.grid(column=0,row=3,sticky="w")
    unlaunchCheck = tkinter.Checkbutton(topFrame, text = "Download latest Unlaunch version?", variable =unlaunch, fg=foregroundColour,font=(buttonFont))
    unlaunchCheck.grid(column=0,row=4,sticky="w")
    seperator = tkinter.Label(topFrame, text="───────────────────────────────────────────────────────────", font=(buttonFont), fg=foregroundColour)
    seperator.grid(column=0,row=5,sticky="w")
    GodMode9iCheck = tkinter.Checkbutton(topFrame, text = "Download latest GodMode9i version?", variable =godmode9i, fg=foregroundColour,font=(buttonFont))
    GodMode9iCheck.grid(column=0,row=6,sticky="w")
    updateHiyaCheck = tkinter.Checkbutton(topFrame, text = "Update hiyaCFW? (must have run hiyaHelper once before)", variable =updateHiyaCFW, fg=foregroundColour,font=(buttonFont))
    updateHiyaCheck.grid(column=0,row=7,sticky="w")
    buttonExtraHomebrew = tkinter.Button(topFrame, text = "Additional homebrew...", command =lambda:[extraHomebrew(window)], fg=foregroundColour,font=(buttonFont),bg=buttonColour)
    buttonExtraHomebrew.grid(column=0,row=8,sticky="w",pady=5)
    backButton = Button(bottomFrame,text="Back", font=(buttonFont),fg=foregroundColour,bg=backButtonColour,command=lambda: [topFrame.destroy(),bottomFrame.destroy(),summonWindow1()], width=button_width)
    backButton.pack(side=tkinter.LEFT)
    nextButton = Button(bottomFrame, text="Next",width=button_width, fg=foregroundColour,bg=nextButtonColour, font=(buttonFont),command=lambda:[topFrame.destroy(),bottomFrame.destroy(),summonWindow3()])
    nextButton.pack(side=tkinter.RIGHT, padx=5, pady=5)
    window.protocol("WM_DELETE_WINDOW",lambda:closeButtonPress(window))
def summonWindow1():
    topFrame = tkinter.Frame(window)
    topFrame.pack(expand=True, fill=tkinter.BOTH,padx=5)
    topFrame.option_add("*Background", backgroundColour)
    bottomFrame = tkinter.Frame(window)
    bottomFrame.pack(side=tkinter.BOTTOM, fill=tkinter.X,padx=5)
    bottomFrame.option_add("*Background", backgroundColour)
    first = tkinter.Label(topFrame, text="Memory Pit", font=(titleFont), fg=foregroundColour)
    first.grid(column=0,row=0, sticky="w",padx=5)
    subtitle = tkinter.Label(topFrame, text='thank you, shutterbug2000!', font=(subtitleFont), fg=foregroundColour)
    subtitle.grid(column=0,row=1, sticky="w",padx=5)
    filler = tkinter.Label(topFrame, text=" ")
    filler.grid(column=0,row=3)
    downloadmemorypitCheck = tkinter.Checkbutton(topFrame, text = "Download Memory pit exploit?",font=(buttonFont),fg=foregroundColour, variable = downloadmemorypit)
    downloadmemorypitCheck.grid(column=0,row=2, sticky="w")
    firmwareLabel = tkinter.Label(topFrame, text = "Select your DSi firmware : ",fg=foregroundColour,font=(buttonFont))
    firmwareLabel.grid(column=0,row=4, sticky="w")
    selector = tkinter.OptionMenu(topFrame, firmwareVersion, *dsiVersions)
    selector.config(bg=buttonColour,fg=foregroundColour,font=(buttonFont))
    selector["menu"].config(bg=buttonColour,fg=foregroundColour,font=(buttonFont))
    selector.grid(column=0,row=5,sticky="w")

    if platform.system() == "Darwin":
        macOS_hiddentext = tkinter.Label(topFrame, text = "(Click the area above this text\n if you can't see the drop down menu) ",fg=foregroundColour,font=(bodyFont))
        macOS_hiddentext.grid(column=0,row=6, sticky="w")

    backButton = Button(bottomFrame,text="Back", font=(buttonFont),fg=foregroundColour,bg=backButtonColour,command=lambda: [topFrame.destroy(),bottomFrame.destroy(),summonWindow0()], width=button_width)
    backButton.pack(side=tkinter.LEFT)
    nextButton = Button(bottomFrame, text="Next",width=button_width, fg=foregroundColour,bg=nextButtonColour, font=(buttonFont),command=lambda:[topFrame.destroy(),bottomFrame.destroy(),summonWindow2()])
    nextButton.pack(side=tkinter.RIGHT, padx=5, pady=5)
    window.protocol("WM_DELETE_WINDOW",lambda:closeButtonPress(window))
def summonWindow5():

    topFrame = tkinter.Frame(window)
    topFrame.pack(expand=True, fill=tkinter.BOTH,padx=5)
    topFrame.option_add("*Background", backgroundColour)
    bottomFrame = tkinter.Frame(window)
    bottomFrame.pack(side=tkinter.BOTTOM, fill=tkinter.X,padx=5)
    bottomFrame.option_add("*Background", backgroundColour)
    first = tkinter.Label(topFrame, text="Completed", font=(titleFont), fg=foregroundColour)
    first.grid(column=0,row=0, sticky="w")
    label= tkinter.Label(topFrame,text="Your SD card is now ready to run and use Homebrew on your Nintendo DSi.",font=(bodyFont),fg=foregroundColour,wraplength=450,justify="left")
    label.grid(column=0,row=2,sticky="w")
    labellink= tkinter.Label(topFrame,text="You can now eject your SD card and follow the steps of https://dsi.cfw.guide/",font=(bodyFont),fg=foregroundColour,wraplength=450,justify="left")
    labellink.grid(column=0,row=3,sticky="w")
    labellink.bind("<Button-1>", lambda e: webbrowser.open_new("https://dsi.cfw.guide/"))
    label= tkinter.Label(topFrame,text="Credits to",font=(bodyFont),fg=foregroundColour)
    label.grid(column=0,row=4,sticky="w")
    bulletpoints = ["YourKalamity - Creator","NightScript - Idea & writer of dsi.cfw.guide","Emiyl - Writer of dsi.cfw.guide","SNBeast - Testing and pointing out errors","Everybody that helped create the homebrew downloaded by this app","Kaisaan - Yes"]
    w = 5
    for x in bulletpoints:
        label = tkinter.Label(topFrame,text=x,font=(bigListFont),fg=foregroundColour)
        label.grid(column=0,row=w,sticky="w")
        w = w + 1
    label= tkinter.Label(topFrame,text="Press the Close button to Exit",font=(bodyFont),fg=foregroundColour)
    label.grid(column=0,row=w+1,sticky="w")
    finish = Button(bottomFrame, text="Close",width=button_width, fg=foregroundColour,bg=nextButtonColour, font=(buttonFont),command=lambda:[topFrame.destroy(),bottomFrame.destroy(),closeButtonPress(window)])
    finish.pack(side=tkinter.RIGHT, padx=5, pady=5)
    window.protocol("WM_DELETE_WINDOW",lambda:closeButtonPress(window))
Esempio n. 6
0
class Application(tk.Frame):
    def __init__(self, master=None):
        super().__init__(master)
        self.master = master
        self.pack()
        self.create_widgets()

    def create_widgets(self):
        self.hi_there = Button(self,
                               text="Hello World",
                               bg='lightblue',
                               fg='yellow',
                               borderless=1)
        self.hi_there["command"] = self.say_hi
        self.hi_there.pack(side="top")

        self.quit = Button(self,
                           text="QUIT",
                           bg='red',
                           fg='yellow',
                           borderless=1,
                           command=self.master.destroy)
        self.quit.pack(side="bottom")

    def say_hi(self):
        print("hi there, everyone!")
def summonWindow0():
    window.title("Lazy DSi file Downloader")
    window.resizable(0, 0)
    window.geometry("500x360")
    window.option_add("*Background", backgroundColour)
    window.configure(bg=backgroundColour)
    topFrame = tkinter.Frame(window)
    topFrame.pack(expand=True, fill=tkinter.BOTH, padx=5)
    topFrame.option_add("*Background", backgroundColour)
    bottomFrame = tkinter.Frame(window)
    bottomFrame.pack(side=tkinter.BOTTOM, fill=tkinter.X, padx=5)
    bottomFrame.option_add("*Background", backgroundColour)
    first = tkinter.Label(topFrame,
                          text="Lazy DSi File Downloader",
                          font=(titleFont),
                          fg=foregroundColour)
    first.grid(column=0, row=0, sticky="w", padx=5)
    bulletpoints = [
        "This program will download all files necessary to run homebrew on your Nintendo DSi.",
        "This is to be used in conjunction with the Nintendo DSi Modding guide by NightScript, emiyl and the rest of the community.",
        "Check it out here: https://dsi.cfw.guide/",
        "By using this application, you don't need to follow any of the 'Preparing SD card' steps.",
        "If you need help, join the Discord server with the button below.",
        "Please proceed by hitting the 'Next' button"
    ]

    for count, x in enumerate(bulletpoints):
        bullet = tkinter.Label(topFrame,
                               text="• " + x,
                               font=(paragraphFont),
                               fg=foregroundColour,
                               wraplength=500,
                               justify="left")
        bullet.grid(column=0, row=count + 3, sticky="w", padx=5)

    discordButton = Button(
        bottomFrame,
        text="DS⁽ⁱ⁾ Mode Hacking Discord server",
        fg=foregroundColour,
        bg=buttonColour,
        font=(buttonFont),
        command=lambda: webbrowser.open("https://discord.gg/yD3spjv", new=1))
    discordButton.pack(side=tkinter.LEFT, padx="5", pady="5")
    nextButton = Button(
        bottomFrame,
        text="Next",
        width=button_width,
        fg=foregroundColour,
        bg=nextButtonColour,
        font=(buttonFont),
        command=lambda:
        [topFrame.destroy(),
         bottomFrame.destroy(),
         summonWindow1()])
    nextButton.pack(side=tkinter.RIGHT, padx=5, pady=5)

    window.protocol("WM_DELETE_WINDOW", lambda: closeButtonPress(window))
def summonWindow4():
    startThread = threading.Thread(target=start, daemon=True)
    topFrame = tkinter.Frame(window)
    topFrame.pack(expand=True, fill=tkinter.BOTH, padx=5)
    topFrame.option_add("*Background", backgroundColour)
    bottomFrame = tkinter.Frame(window)
    bottomFrame.pack(side=tkinter.BOTTOM, fill=tkinter.X, padx=5)
    bottomFrame.option_add("*Background", backgroundColour)
    first = tkinter.Label(topFrame,
                          text="Download Screen",
                          font=(titleFont),
                          fg=foregroundColour)
    first.grid(column=0, row=0, sticky="w")
    subtitle = tkinter.Label(topFrame,
                             text='please wait...',
                             font=(subtitleFont),
                             fg=foregroundColour)
    subtitle.grid(column=0, row=1, sticky="w")
    global outputBox
    outputBox = tkinter.Text(topFrame,
                             state='disabled',
                             width=60,
                             height=15,
                             bg="black",
                             fg="white")
    outputBox.grid(column=0, row=2, sticky="w")
    startThread.start()
    global finalbackButton
    finalbackButton = Button(
        bottomFrame,
        state="disabled",
        text="Back",
        font=(buttonFont),
        fg=foregroundColour,
        bg=backButtonColour,
        command=lambda:
        [topFrame.destroy(),
         bottomFrame.destroy(),
         summonWindow3()],
        width=button_width)
    finalbackButton.pack(side=tkinter.LEFT)
    global finalnextButton
    finalnextButton = Button(
        bottomFrame,
        state="disabled",
        text="Finish",
        width=button_width,
        fg=foregroundColour,
        bg=nextButtonColour,
        font=(buttonFont),
        command=lambda:
        [topFrame.destroy(),
         bottomFrame.destroy(),
         summonWindow5()])
    finalnextButton.pack(side=tkinter.RIGHT, padx=5, pady=5)
    window.protocol("WM_DELETE_WINDOW", lambda: donothing)
def extraHomebrew(source):
    homebrewWindow = tkinter.Toplevel(source)
    homebrewWindow.config(bg="#f0f0f0")
    source.withdraw()
    homebrewWindowLabel = tkinter.Label(homebrewWindow,
                                        text="Homebrew List",
                                        font=("Segoe UI", 12, "bold"),
                                        bg="#f0f0f0",
                                        fg="#000000")
    homebrewWindowLabel.pack(anchor="w")
    homebrewWindowLabel2 = tkinter.Label(
        homebrewWindow,
        text="Select additional homebrew for download then press OK",
        font=(bodyFont),
        bg="#f0f0f0",
        fg="#000000")
    homebrewWindowLabel2.pack(anchor="w")
    vscrollbar = tkinter.Scrollbar(homebrewWindow)
    canvas = tkinter.Canvas(homebrewWindow, yscrollcommand=vscrollbar.set)
    canvas.config(bg="#f0f0f0")
    vscrollbar.config(command=canvas.yview)
    vscrollbar.pack(side=tkinter.RIGHT, fill=tkinter.Y)
    homebrewFrame = tkinter.Frame(canvas)
    homebrewFrame.configure(bg="#f0f0f0")
    homebrewWindow.title("Homebrew List")
    homebrewWindow.resizable(0, 0)
    canvas.pack(side="left", fill="both", expand=True)
    canvas.create_window(0, 0, window=homebrewFrame, anchor="n")
    for count, x in enumerate(homebrewDB):
        homebrewListMenu = tkinter.Checkbutton(homebrewFrame,
                                               text=x["title"] + " by " +
                                               x["author"],
                                               font=(bigListFont),
                                               variable=homebrewList[count],
                                               bg="#f0f0f0",
                                               fg="#000000")
        homebrewListMenu.config(selectcolor="#F0F0F0")
        homebrewListMenu.pack(anchor="w")
    frame = tkinter.ttk.Frame(homebrewWindow,
                              relief=tkinter.RAISED,
                              borderwidth=1)
    frame.pack(fill=tkinter.BOTH, expand=True)
    okButton = Button(homebrewWindow,
                      text="OK",
                      font=(buttonFont),
                      command=lambda: okButtonPress(homebrewWindow, source),
                      bg="#f0f0f0",
                      fg="#000000")
    okButton.pack(side=tkinter.RIGHT, padx=5, pady=5)
    homebrewWindow.update()
    canvas.config(scrollregion=canvas.bbox("all"))
    homebrewWindow.protocol("WM_DELETE_WINDOW",
                            lambda: okButtonPress(homebrewWindow, source))
Esempio n. 10
0
    def add_button(self, b, r, c, frames, col=None):
        if platform.system() in ["Darwin"]:
            kwargs = {
                "activebackground": self.colors["inactive"],
                "borderless": True,
                "height": 50,
                "width": 70,
            }
        else:
            kwargs = {"height": 4, "width": 10}

        f = Frame(frames[b + 2], bg=self.colors["bg"])
        f.grid(row=r, column=c)
        bt = Button(f,
                    text=col[2] if col else '',
                    bg=self.colors["inactive"],
                    **kwargs)
        self.w_buttons[b].append(bt)

        if col:
            key = col[2]
            if key == "\\":
                key = "backslash"
            self.bind(
                f"<KeyPress-{key}>",
                lambda *args, rowx=r, colx=c, bankx=b, **kwargs: self.
                button_press_repeat(rowx, colx, bankx, *args, **kwargs),
            )

            self.bind(
                f"<KeyRelease-{key}>",
                lambda *args, rowx=r, colx=c, bankx=b, **kwargs: self.
                button_release_repeat(rowx, colx, bankx, *args, **kwargs),
            )

        bt.bind(
            "<ButtonPress>",
            lambda *args, rowx=r, colx=c, bankx=b, **kwargs: self.button_press(
                rowx, colx, bankx, *args, **kwargs),
        )
        bt.bind(
            "<ButtonRelease>",
            lambda *args, rowx=r, colx=c, bankx=b, **kwargs: self.
            button_release(rowx, colx, bankx, *args, **kwargs),
        )
        bt.pack(side=TOP, fill=X)
        if col:
            lb = Label(f, text=col[0] if col else '', bg=self.colors["bg"])
            lb.pack(side=TOP, fill=X)
            lb = Label(f, text=col[1] if col else '', bg=self.colors["bg"])
            lb.pack(side=TOP, fill=X)
Esempio n. 11
0
def main(Root, frame, subject):

    global Questionframe
    global ParsedQuestion
    global ParsedAnswer
    global button
    global NextFrame
    global root
    global statusBar
    global totalQuestion

    root = Root

    #divide approprate questions and multiple choice answers
    ParsedQuestion, ParsedAnswer = getSubQuestion(str(subject))

    frame.destroy()
    root.title("FunSmart " + str(subject) + " Prestest Screen")

    # create new frame that will replace the previous one
    frame = Frame(root, bg="white")
    frame.place(relwidth=0.8, relheight=0.8, relx=0.1, rely=0.1)

    # create question frames storing only next question button
    Questionframe = Frame(frame, bg="white")
    Questionframe.pack(side="top", fill="x")

    NextFrame = Frame(frame, bg="white")
    NextFrame.pack(side="bottom", fill="x")

    # Question = Label(Questionframe, text= "Welcome to the "+str(subject) + " pre-test, please click 'Next Question' to continue")

    Question = Label(Questionframe,
                     font=("Arial", 11),
                     wraplength=480,
                     justify=LEFT,
                     text="Welcome to the " + str(subject) +
                     " pre-test, please click 'Next Question' to continue")
    Question.grid(row=1, column=0)

    statusBar = Label(NextFrame,
                      text=str(questionIndex) + " - " + str(totalQuestion))
    statusBar.pack(anchor=W)

    button = Button(NextFrame,
                    bg="#82E0AA",
                    text="Next Question",
                    command=lambda: nextQuestion(frame, subject))
    button.pack(anchor=E)
Esempio n. 12
0
def main(root, frame):
    frame.destroy()
    root.title("FunSmart Home Screen")
    frame = Frame(root, )
    frame.place(relwidth=0.8, relheight=0.8, relx=0.1, rely=0.1)
    photo3 = PhotoImage(file="funsmart.png")
    w = Label(frame, image=photo3)
    w.pack()

    subjects = Methods.fileSplitter("subjectSelector.txt")

    btn = Button(frame,
                 font=("Arial", 14, "italic"),
                 foreground='white',
                 text=subjects[0],
                 height=80,
                 padx=100,
                 pady=50,
                 bg='#82E0AA',
                 command=lambda: PreTest.main(root, frame, subjects[0]))
    # btn = Button(frame,font=("Arial", 14, "italic"),foreground = 'white',  text = subjects[0], height=60,pady=20, bg='#28C275', command = lambda: PreTest.main(root, frame, subjects[0]))
    btn.pack()

    btn1 = Button(frame,
                  font=("Arial", 14, "italic"),
                  foreground='white',
                  text=subjects[1],
                  height=80,
                  padx=100,
                  pady=50,
                  bg="#82E0AA",
                  command=lambda: PreTest.main(root, frame, subjects[1]))
    btn1.pack()

    btn2 = Button(frame,
                  font=("Arial", 14, "italic"),
                  foreground='white',
                  text=subjects[2],
                  height=80,
                  padx=100,
                  pady=50,
                  bg="#82E0AA",
                  command=lambda: PreTest.main(root, frame, subjects[2]))
    btn2.pack()

    # btn3 = Button(frame, text = subjects[3], padx = 100, pady=50, height=20, bg="lightgreen", command = lambda: PreTest.main(root, frame, subjects[3]))
    btn3 = Button(frame,
                  font=("Arial", 14, "italic"),
                  foreground='white',
                  text=subjects[3],
                  height=80,
                  padx=100,
                  pady=50,
                  bg="#82E0AA",
                  command=lambda: PreTest.main(root, frame, subjects[3]))
    btn3.pack()
def summonWindow3():
    topFrame = tkinter.Frame(window)
    topFrame.pack(expand=True, fill=tkinter.BOTH,padx=5)
    topFrame.option_add("*Background", backgroundColour)
    bottomFrame = tkinter.Frame(window)
    bottomFrame.pack(side=tkinter.BOTTOM, fill=tkinter.X,padx=5)
    bottomFrame.option_add("*Background", backgroundColour)
    first = tkinter.Label(topFrame, text="Select SD Card", font=(titleFont), fg=foregroundColour)
    first.grid(column=0,row=0, sticky="w")
    subtitle = tkinter.Label(topFrame, text='ready to download?', font=(subtitleFont), fg=foregroundColour)
    subtitle.grid(column=0,row=1,sticky="w")
    noticeLabel=tkinter.Label(topFrame,text="Plug in your SD card and choose the directory", fg=foregroundColour, font=(bodyFont))
    noticeLabel.grid(column=0,row=2,sticky="w")
    SDentry = tkinter.Entry(topFrame, fg=foregroundColour,bg=buttonColour,font=(buttonFont),width=25)
    SDentry.grid(column=0, row=3,sticky="w")
    chooseDirButton = Button(topFrame, text = "Click to select folder", command =lambda:chooseDir(topFrame,SDentry),fg=foregroundColour,bg=buttonColour,font=(buttonFont),width=folder_width)
    chooseDirButton.grid(column=0, row=4,sticky="w",pady=5)
    backButton = Button(bottomFrame,text="Back", font=(buttonFont),fg=foregroundColour,bg=backButtonColour,command=lambda: [topFrame.destroy(),bottomFrame.destroy(),summonWindow2()], width=button_width)
    backButton.pack(side=tkinter.LEFT)
    nextButton = Button(bottomFrame, text="Start",width=button_width, fg=foregroundColour,bg=nextButtonColour, font=(buttonFont),command=lambda:[globalify(SDentry.get()),topFrame.destroy(),bottomFrame.destroy(),summonWindow4()])
    nextButton.pack(side=tkinter.RIGHT, padx=5, pady=5)
    window.protocol("WM_DELETE_WINDOW",lambda:closeButtonPress(window))
Esempio n. 14
0
def main(root, frame):
    frame.destroy()
    root.title("FunSmart Home Screen")
    frame = Frame(root, bg="white")
    frame.place(relwidth=0.8, relheight=0.8, relx=0.1, rely=0.1)

    subjects = Methods.fileSplitter("subjectSelector.txt")

    btn = Button(frame,
                 text=subjects[0],
                 padx=100,
                 pady=50,
                 bg='lightgreen',
                 command=lambda: PreTest.main(root, frame, subjects[0]))
    btn.pack()

    btn1 = Button(frame,
                  text=subjects[1],
                  padx=100,
                  pady=50,
                  bg="lightgreen",
                  command=lambda: PreTest.main(root, frame, subjects[1]))
    btn1.pack()

    btn2 = Button(frame,
                  text=subjects[2],
                  padx=100,
                  pady=50,
                  bg="lightgreen",
                  command=lambda: PreTest.main(root, frame, subjects[2]))
    btn2.pack()

    btn3 = Button(frame,
                  text=subjects[3],
                  padx=92,
                  pady=50,
                  bg="lightgreen",
                  command=lambda: PreTest.main(root, frame, subjects[3]))
    btn3.pack()
Esempio n. 15
0
def nextQuestion(frame, subject):
    global answered
    global Questionframe
    global ParsedQuestion
    global ParsedAnswer
    global questionIndex
    global button
    global NextFrame
    global statusBar

    # Display answer and retreive answer and check if the answer is correct
    if answered == False:
        answered = True
        Questionframe.destroy()

        Questionframe = Frame(frame, bg="white")
        # Questionframe.pack(side=LEFT, anchor='nw')
        # Questionframe.pack(side="top", fill="x")
        Questionframe.pack(side=LEFT, fill=Y)

        Question = Message(Questionframe,
                           width=480,
                           text=ParsedQuestion[questionIndex],
                           font=(
                               "Arial",
                               13,
                           ))
        Question.grid(row=0, columnspan=2)

        tempIndex = questionIndex + 1
        statusBar.config(text=str(tempIndex) + " - " + str(totalQuestion))

        #multiple Choice list for user answers
        multChoices = [
            str(ParsedAnswer[questionIndex][0]),
            str(ParsedAnswer[questionIndex][1]),
            str(ParsedAnswer[questionIndex][2]),
            str(ParsedAnswer[questionIndex][3])
        ]

        # identify the correct answer from the list
        correctAns = ParsedAnswer[questionIndex][0]
        # Shuffle entire list
        random.shuffle(multChoices)
        # Display list to user
        v = StringVar()

        Radiobutton(
            Questionframe,
            wraplength=300,
            justify=LEFT,
            font=(
                "Arial",
                12,
            ),
            text=multChoices[0],
            variable=v,
            value="answer1",
            command=lambda: checkAns(frame, correctAns, multChoices[0])).grid(
                row=1, column=1, sticky=W)
        Radiobutton(
            Questionframe,
            wraplength=300,
            justify=LEFT,
            font=(
                "Arial",
                12,
            ),
            text=multChoices[1],
            variable=v,
            value="answer2",
            command=lambda: checkAns(frame, correctAns, multChoices[1])).grid(
                row=2, column=1, sticky=W)
        Radiobutton(
            Questionframe,
            wraplength=300,
            justify=LEFT,
            font=(
                "Arial",
                12,
            ),
            text=multChoices[2],
            variable=v,
            value="answer3",
            command=lambda: checkAns(frame, correctAns, multChoices[2])).grid(
                row=3, column=1, sticky=W)
        Radiobutton(
            Questionframe,
            wraplength=300,
            justify=LEFT,
            font=(
                "Arial",
                12,
            ),
            text=multChoices[3],
            variable=v,
            value="answer4",
            command=lambda: checkAns(frame, correctAns, multChoices[3])).grid(
                row=4, column=1, sticky=W)

        #increment quesiton list until 10th increment
        if questionIndex < 9:
            questionIndex += 1
        # enable the submit button
        else:

            button.destroy()
            button = Button(NextFrame,
                            text="Submit",
                            command=lambda: placement(frame, subject))
            button.pack(anchor=E)
    return
Esempio n. 16
0
        ec.capture(0, False, 'image.jpg')
        if image_analysis():
            break
        time.sleep(2)
    warning.config(fg='black', bg='red', text='Non-masked customer detected')


window = Tk()
window.title("COVID Guard")
window.geometry('500x500')

btn = Button(
    window,
    text="Click to Begin Surveillance",
    bg='white',
    fg='Black',
    borderless=1,
    font=("roboto", 20),
    command=clicked,
)
warning = Label(
    window,
    fg='spring green', bg='forest green', text='All Customers are Masked',
    height=40,
    width=100
)

btn.pack(fill='both')
warning.pack()
window.mainloop()
Esempio n. 17
0
# Defining an instance of the tk object
window = tk.Tk()

# adding labels:
label = tk.Label(text="Welcome to ",
                 foreground='white',
                 background='black',
                 height=2)

# Start game button
button = Button(window,
                text='Start the Game!',
                bg='black',
                fg='white',
                borderless=1)

# Input from user
entry = Entry(fg='white', bg='black', width=10)
userInput = entry.get()

# Set width + height of window
frame = Frame(window, width=300, height=300)

# Apply to window
label.pack()
button.pack()
entry.pack()
frame.pack()

# initialize window
window.mainloop()
Esempio n. 18
0
    )
    post_box.send_keys(message)

    post_button = driver.find_element_by_xpath(
        "//*[@id='mount_0_0']/div/div[1]/div[1]/div[4]/div/div/div[1]/div/div[2]/div/div/div/form/div/div[1]/div/div/div[1]/div[3]/div[2]/div[1]"
    )

    post_button.click()
    sleep(5)


submit = Button(main,
                text="Generate pairings",
                bg='#0066CC',
                fg='white',
                command=data_to_post)

#Displaying GUI
title.pack()
warning.pack()
email_lab.pack()
email_in.pack()
password_lab.pack()
password_in.pack()
group_lab.pack()
group_in.pack()
csv.pack()
submit.pack(side=BOTTOM)

main.mainloop()
Esempio n. 19
0
class Application(tk.Frame):
    def __init__(self, master=None):
        super().__init__(master)
        self.master = master
        self.pack()
        self.create_widgets()

    def create_widgets(self):
        self.get_csv = Button(self,
                              text='click Here to import sales data',
                              command=self.update_db)
        self.get_csv.pack(side="top")

        self.export_sales = Button(
            self,
            text='click Here to Genereate fuiou sales reports',
            command=self.get_sales_report)
        self.export_sales.pack(side="top")

        self.export_sales = Button(
            self,
            text='click Here to Genereate Payeco sales reports',
            command=self.get_payeco_sales_report)
        self.export_sales.pack(side="top")

        self.export_sales = Button(self,
                                   text='update_db_struct',
                                   command=self.updatupdate_db_structe_db)
        self.export_sales.pack(side="top")

        self.export_sales = Button(self,
                                   text='create_db_struct',
                                   command=self.updatupdate_db_structe_db)
        self.export_sales.pack(side="top")

        self.quit = Button(self,
                           text="QUIT",
                           fg="red",
                           command=self.master.destroy)
        self.quit.pack(side="bottom")

    def update_db(self):
        try:
            messagebox.showinfo("Currenxie", "Select your reports folder")
            reportsDir = filedialog.askdirectory()
            result = import_amazon_salesdata(reportsDir, dbdir, example_dir)
            messagebox.showinfo(result['title'], result['message'])
        except Exception as e:
            messagebox.showinfo("Error", str(e))

    def create_db(self):
        try:
            result = update_db_struct("20000101000000", workspace, dbdir)
            messagebox.showinfo(result['title'], result['message'])
        except Exception as e:
            messagebox.showinfo("Error", str(e))

    def updatupdate_db_structe_db(self):
        try:
            result = update_db_struct("20191015121212", workspace, dbdir)
            messagebox.showinfo(result['title'], result['message'])
        except Exception as e:
            messagebox.showinfo("Error", str(e))

    def get_sales_report(self):
        try:
            messagebox.showinfo("Currenxie", "Select your TRADES FILE")
            file_path = filedialog.askopenfilename()
            result = generate_sales_report(file_path, dbdir, example_dir)
            messagebox.showinfo(result['title'], result['message'])
        except Exception as e:
            messagebox.showinfo("Error", str(e))

    def get_payeco_sales_report(self):
        try:
            messagebox.showinfo("Currenxie", "Select your TRADES FILE")
            file_path = filedialog.askopenfilename()
            result = generate_payeco_sales_report(file_path, dbdir,
                                                  example_dir)
            messagebox.showinfo(result['title'], result['message'])
        except Exception as e:
            messagebox.showinfo("Error", str(e))
Esempio n. 20
0
                  relief=GROOVE,
                  borderwidth=5,
                  padx=30,
                  pady=20,
                  command=gui_record1)
button_4 = Button(frame1,
                  text='Play',
                  relief=GROOVE,
                  borderwidth=5,
                  padx=30,
                  pady=20,
                  command=gui_play1)
#showing frame1
frame1.grid(row=0, column=0, padx=20)
#Packing buttons for frame1
button_1.pack(pady=10)
button_2.pack(pady=10)
button_3.pack(pady=10)
button_4.pack(pady=10)
#Binding buttons for frame1
button_2.bind_all("<Key>", key_bind_func)
button_3.bind_all("<Key>", key_bind_func)
button_4.bind_all("<Key>", key_bind_func)

# Creating Frame2
frame2 = LabelFrame(blank, text='Channel 2', padx=5, pady=5)
#Creating Buttons for Frame2
button_5 = Button(frame2,
                  text='Preset',
                  relief=GROOVE,
                  borderwidth=5,
Esempio n. 21
0
        listbox.insert(tk.END, "Usable Balance Is: {:.8f}".format(
            usable_balance))  #PRINT USABLE BALANCE

        #listbox.insert(tk.END,"Unused TXNs") #PRINT UNUSED TXNS

        #wallet.list_utxos(node) #PRINT UTXOS

    command_entry.delete(0, tk.END)


frame_bottom = tk.Frame()

command_entry = tk.Entry(master=frame_bottom)

command_entry.pack(fill=tk.X, side=tk.LEFT, expand=True)

command_submit = Button(master=frame_bottom, text="Submit")

command_submit.pack()

command_submit.bind("<Button-1>", command_click)

#frame_top.pack()

#frame_2.pack(fill=tk.BOTH)

frame_3.pack(fill=tk.BOTH, expand=True)

frame_bottom.pack(fill=tk.X)

window.mainloop()
Esempio n. 22
0
    'money': [20000, 30000, 23000, 20000]
}
# กราฟแบบจุด
df = DataFrame(data)
df.plot(kind='scatter', x='name', y='age', color='red')
plt.show()

# กราฟแบบเส้น
ax = plt.gca()
df.plot(kind='line', x='name', y='age', color='red',ax=ax)
df.plot(kind='line', x='name', y='money', color='blue', ax=ax)
plt.show()


'''

from tkinter import *
from tkinter import ttk
from tkinter import messagebox
from tkmacosx import Button

windows = Tk()
windows.geometry('600x400+800+100')

B1 = Button(windows, text='Mac OSX', bg='black', fg='green', borderless=1)
B1.pack()
B2 = Button(windows, text='Mac OSX', bg='blue', fg='red', borderless=1)
B2.pack()

windows.mainloop()
Esempio n. 23
0
player_score_label = Label(player_score,
                           bg=background_color,
                           text='Player Score: ',
                           **button_args)
player_score_label.pack()

dealer_score_label = Label(dealer_score,
                           bg=background_color,
                           text="Dealer Score: ",
                           **button_args)
dealer_score_label.pack()
#Score Board END

#player options in the game:
deal = Button(player_options_frame, text='DEAL', **button_args, bg="#34CA3A")
deal.pack(**pack_left_and_fill_y)

player_game_options_frame = Frame(player_options_frame, bg=background_color)
player_game_options_frame.pack(**pack_left_and_fill_y)

#player options in the deal:
hit = Button(player_game_options_frame,
             text='HIT',
             bg='red',
             **button_args,
             state=DISABLED,
             name='hit')
stand = Button(player_game_options_frame,
               text='STAND',
               bg='#B5BD18',
               **button_args,
Esempio n. 24
0
class Calculator(tk.Frame):
    def __init__(self, master=None):
        tk.Frame.__init__(self, master)
        self.grid()
        self.createWidgets()

    lhs = 0
    rhs = ""
    total = 0
    operand = None
    small_width = 55
    large_width = 110
    height = 60
    result_font = ("Helvetica", 50)
    label_font = 10

    def clear(self):
        print("clear")
        self.lhs = 0
        self.rhs = ""
        self.total = 0
        self.result.configure(text="0")

    def togglepm(self):
        print("toggle plus/minus")
        if self.rhs is not "":
            self.rhs = str(float(self.rhs) * -1)
            self.result.configure(text=self.rhs)
        else:
            self.lhs = self.lhs * -1
            self.result.configure(text=self.lhs)

    def equals(self):
        print("equals")
        self.calculate()

    def digit(self, digit):
        print(digit)
        self.rhs = self.rhs + digit
        self.result.configure(text=self.rhs)

    def operator(self, operation):
        print(operation)
        if self.rhs is not "":
            self.lhs = float(self.rhs)
        self.rhs = ""
        self.operand = operation

    def percent(self):
        print("percent")
        if self.rhs is not "":
            self.rhs = str(float(self.rhs) / 100)
            self.result.configure(text=self.rhs)
        else:
            self.total = self.total / 100
            self.rhs = self.total
            self.result.configure(text=self.total)

    def calculate(self):
        total = 0
        if self.rhs is not "":
            rhs = float(self.rhs)
        else:
            rhs = 0
        if self.operand is "divide":
            total = self.lhs / rhs
        elif self.operand is "multiply":
            total = self.lhs * rhs
        elif self.operand is "add":
            total = self.lhs + rhs
        elif self.operand is "subtract":
            total = self.lhs - rhs
        self.operand = None
        self.total = total
        self.lhs = total
        self.rhs = ""
        self.result.configure(text=total)

    def makeButton(self, frame, text, width, height, command, bg, fg):
        #        self.button = tk.Button(frame, text=text, width=width, command=command, highlightbackground=bg, fg=fg)
        self.button = Button(frame,
                             text=text,
                             width=width,
                             height=height,
                             command=command,
                             bg=bg,
                             fg=fg)
        self.button.pack(side=tk.LEFT)

    def createWidgets(self):
        print(self.winfo_geometry())
        self.result = tk.Label(self,
                               text="0",
                               anchor=tk.E,
                               font=self.result_font,
                               bg="#3C3C3C",
                               fg="#D4D4D2")
        self.result.pack(fill="both", expand=1)

        f1 = tk.Frame(self)
        self.makeButton(f1, "C", self.small_width, self.height, self.clear,
                        "#696969", "#D4D4D2")
        self.makeButton(f1, "+/-", self.small_width, self.height,
                        self.togglepm, "#696969", "#D4D4D2")
        self.makeButton(f1, "%", self.small_width, self.height, self.percent,
                        "#696969", "#D4D4D2")
        self.makeButton(f1,
                        "/",
                        self.small_width,
                        self.height,
                        lambda x="divide": self.operator(x),
                        "#FF9500",
                        "#D4D4D2")
        f1.pack(fill="both", expand=1)

        f2 = tk.Frame(self)
        self.makeButton(f2,
                        "7",
                        self.small_width,
                        self.height,
                        lambda x="7": self.digit(x),
                        "#8C8C8C",
                        "#D4D4D2")
        self.makeButton(f2,
                        "8",
                        self.small_width,
                        self.height,
                        lambda x="8": self.digit(x),
                        "#8C8C8C",
                        "#D4D4D2")
        self.makeButton(f2,
                        "9",
                        self.small_width,
                        self.height,
                        lambda x="9": self.digit(x),
                        "#8C8C8C",
                        "#D4D4D2")
        self.makeButton(f2,
                        "X",
                        self.small_width,
                        self.height,
                        lambda x="multiply": self.operator(x),
                        "#FF9500",
                        "#D4D4D2")
        f2.pack(fill="both", expand=1)

        f3 = tk.Frame(self)
        self.makeButton(f3,
                        "4",
                        self.small_width,
                        self.height,
                        lambda x="4": self.digit(x),
                        "#8C8C8C",
                        "#D4D4D2")
        self.makeButton(f3,
                        "5",
                        self.small_width,
                        self.height,
                        lambda x="5": self.digit(x),
                        "#8C8C8C",
                        "#D4D4D2")
        self.makeButton(f3,
                        "6",
                        self.small_width,
                        self.height,
                        lambda x="6": self.digit(x),
                        "#8C8C8C",
                        "#D4D4D2")
        self.makeButton(f3,
                        "-",
                        self.small_width,
                        self.height,
                        lambda x="subtract": self.operator(x),
                        "#FF9500",
                        "#D4D4D2")
        f3.pack(fill="both", expand=1)

        f4 = tk.Frame(self)
        self.makeButton(f4,
                        "1",
                        self.small_width,
                        self.height,
                        lambda x="1": self.digit(x),
                        "#8C8C8C",
                        "#D4D4D2")
        self.makeButton(f4,
                        "2",
                        self.small_width,
                        self.height,
                        lambda x="2": self.digit(x),
                        "#8C8C8C",
                        "#D4D4D2")
        self.makeButton(f4,
                        "3",
                        self.small_width,
                        self.height,
                        lambda x="3": self.digit(x),
                        "#8C8C8C",
                        "#D4D4D2")
        self.makeButton(f4,
                        "+",
                        self.small_width,
                        self.height,
                        lambda x="add": self.operator(x),
                        "#FF9500",
                        "#D4D4D2")
        f4.pack(fill="both", expand=1)

        f5 = tk.Frame(self)
        self.makeButton(f5,
                        "0",
                        self.large_width,
                        self.height,
                        lambda x="0": self.digit(x),
                        "#8C8C8C",
                        "#D4D4D2")
        self.makeButton(f5,
                        ".",
                        self.small_width,
                        self.height,
                        lambda x=".": self.digit(x),
                        "#8C8C8C",
                        "#D4D4D2")
        self.makeButton(f5, "=", self.small_width, self.height, self.equals,
                        "#FF9500", "#D4D4D2")
        f5.pack(fill="both", expand=1)
Esempio n. 25
0
# myLabel3.grid(row=2, column=2)

# def my_click():
#     myLabel = Label(root, text='Look! I clicked a Button!')
#     myLabel.pack()

# myButton = Button(root, text='Click Me!', command=my_click, fg='#496920', bg='#f8c55e', borderless=1, width=100, height=50)
# myButton.pack()

# my_img = ImageTk.PhotoImage(Image.open('react-removebg-preview.png'))
# my_label = Label(image=my_img)
# my_label.pack()

frame1 = LabelFrame(root,
                    text='This is my Frame...',
                    padx=5,
                    pady=5,
                    relief=GROOVE,
                    borderwidth=3)
b = Button(frame1, text="Don't Click here")
b.pack()

frame2 = LabelFrame(master=root, text='2nd frame', padx=5, pady=5)
label_b = Label(master=frame2, text='I am in 2nd frame')
label_b.pack()

frame1.grid(row=0, column=0, padx=10, pady=10)
frame2.grid(row=0, column=1, padx=10, pady=10)

# Make a eventloop
root.mainloop()
Esempio n. 26
0
root.configure(background='white')

frame1 = Frame(root, bg='sky blue', bd=10)
frame1.pack(side=TOP)

canvas1 = Canvas(frame1, width=400, height=400)
canvas1.pack()

frame2 = Frame(root)

c1 = Button(frame2,
            text=" ",
            borderless=1,
            bg='magenta2',
            command=lambda: Color('R'))
c1.pack(side=LEFT)

c2 = Button(frame2,
            text=" ",
            borderless=1,
            bg='cyan',
            command=lambda: Color('C'))
c2.pack(side=LEFT)

c3 = Button(frame2,
            text=" ",
            borderless=1,
            bg='purple2',
            command=lambda: Color('P'))
c3.pack(side=LEFT)
Esempio n. 27
0
 def __init__(self, master):
     global palette
     tiles = []
     bin_tiles = []
     for _ in range(8):
         bin_tiles.append(['0', '0', '0', '0', '0', '0', '0', '0'])
     def callback(event, mode):
         col_width = c.winfo_width()/8
         row_height = c.winfo_height()/8
         col = event.x//col_width
         row = event.y//row_height
         try:
             if mode == 'draw':
                 c.create_rectangle(col*col_width, row*row_height, (col+1)*col_width, (row+1)*row_height, fill=globals()[palette[color_number]], outline='')
                 bin_tiles[int(row)][int(col)] = str(color_number+1)
             else:
                 c.create_rectangle(col*col_width, row*row_height, (col+1)*col_width, (row+1)*row_height, fill='white', outline='')
                 bin_tiles[int(row)][int(col)] = '0'
         except:
             pass
     frame1=Frame(master)
     frame1.pack(side=TOP)
     c = Canvas(frame1, width=200, height=200, borderwidth=0, background='white')
     c.pack()
     key = 'B1-Motion'
     c.bind(('<'+key+'>'), lambda event: callback(event, 'draw'))
     c.bind(('<Command-'+key+'>'), lambda event: callback(event, 'erase'))
     button_frame = Frame(master, height=200)
     button_frame.pack(fill=X)
     def change_color(colnum):
         global color_number
         color_number = colnum
     def new():
         c.delete('all')
         palette.clear()
         tiles.clear()
         bin_tiles.clear()
         for _ in range(8):
             tiles.append([None, None, None, None, None, None, None, None])
             bin_tiles.append(['0', '0', '0', '0', '0', '0', '0', '0'])
         top = Toplevel()
         top.title('Color Palette Picker')
         top.geometry('600x100')
         def donothing():
             pass
         top.protocol("WM_DELETE_WINDOW", donothing)
         app = ColorPalettePicker(top)
         color1.config(bg=globals()[palette[0]], command=lambda: change_color(0))
         color2.config(bg=globals()[palette[1]], command=lambda: change_color(1))
         color3.config(bg=globals()[palette[2]], command=lambda: change_color(2))
     def save():
         final = []
         for a in bin_tiles:
             for b in a:
                 final.append(b)
         bin_final = []
         for i in final:
             binary = str(bin(int(i))[2:])
             if binary == '0':
                 bin_final.append('0'+binary)
             elif binary == '1':
                 bin_final.append('0'+binary)
             else:
                 bin_final.append(binary)
         tmp1 = ''.join([i[0] for i in bin_final])
         sprite1 = [tmp1[i:i+8] for i in range(0, len(tmp1), 8)]
         tmp2 = ''.join([i[1] for i in bin_final])
         sprite2 = [tmp2[i:i+8] for i in range(0, len(tmp2), 8)]
         sprite1 = [hex(int(i, 2)) for i in sprite1]
         sprite2 = [hex(int(i, 2)) for i in sprite2]
         finalhexsprite = sprite1 + sprite2
         file = asksaveasfile(mode ='wb', defaultextension='*.bin')
         if file != None:
             file.write(bytes([int(x, 16) for x in finalhexsprite]))
             file.close()
     color1 = Button(button_frame, height=20, width=30, borderless = 1, bg=globals()[palette[0]], command=lambda: change_color(0))
     color1.pack(side=LEFT)
     color2 = Button(button_frame, height=20, width=30, borderless = 1, bg=globals()[palette[1]], command=lambda: change_color(1))
     color2.pack(side=LEFT)
     color3 = Button(button_frame, height=20, width=30, borderless = 1, bg=globals()[palette[2]], command=lambda: change_color(2))
     color3.pack(side=LEFT)
     newbtn = Button(button_frame, text='New', height=20, width=50, borderless = 1, command=new)
     newbtn.pack(side=RIGHT)
     savebtn = Button(button_frame, text='Save', height=20, width=50, borderless = 1, command=save)
     savebtn.pack(side=RIGHT)
Esempio n. 28
0
class RoundSettings:
    def __init__(self):
        self.win = tk.Tk()
        self.win.title("Round Settings")
        self.choose_frame = tk.Frame(self.win)
        self.confirm_frame = tk.Frame(self.win, width=100)
        self.frame1 = tk.Frame(self.choose_frame)
        self.frame2 = tk.Frame(self.choose_frame)
        self.frame3 = tk.Frame(self.choose_frame)
        self.first_hint = tk.Label(self.frame1,
                                   text="Choose which side will play first")
        self.me_first = Button(self.frame1,
                               text="Me",
                               command=self.click_me_first)
        self.opponent_first = Button(self.frame1,
                                     text="Opponent",
                                     command=self.click_opponent_first)
        self.player_hint = tk.Label(self.frame2,
                                    text="Choose which side you will play for")
        self.for_black = Button(self.frame2,
                                text="Black Chess",
                                command=self.click_for_black)
        self.for_white = Button(self.frame2,
                                text="White Chess",
                                command=self.click_for_white)
        self.up_hint = tk.Label(self.frame3,
                                text="Choose which side will on the upper")
        self.white_up = Button(self.frame3,
                               text="White Chess",
                               command=self.click_white_up)
        self.black_up = Button(self.frame3,
                               text="Black Chess",
                               command=self.click_black_up)
        self.confirm_button = tk.Button(self.confirm_frame,
                                        width=10,
                                        height=10,
                                        text='play',
                                        command=self.click_confirm)

    def choose(self):
        self.first_hint.pack(side=tk.TOP)
        self.me_first.pack(side=tk.LEFT)
        self.opponent_first.pack(side=tk.RIGHT)
        self.player_hint.pack(side=tk.TOP)
        self.for_black.pack(side=tk.LEFT)
        self.for_white.pack(side=tk.RIGHT)
        self.up_hint.pack(side=tk.TOP)
        self.white_up.pack(side=tk.LEFT)
        self.black_up.pack(side=tk.RIGHT)
        self.confirm_button.pack()
        self.frame1.pack()
        self.frame2.pack()
        self.frame3.pack()
        self.choose_frame.pack(side=tk.LEFT)
        self.confirm_frame.pack(side=tk.RIGHT)
        self.win.mainloop()

    def click_me_first(self):
        global first_player
        first_player = 'me'
        self.me_first.configure(fg='white', bg='deepskyblue')
        self.opponent_first.configure(fg='black', bg='white')

    def click_opponent_first(self):
        global first_player
        first_player = 'opponent'
        self.opponent_first.configure(fg='white', bg='deepskyblue')
        self.me_first.configure(fg='black', bg='white')

    def click_for_black(self):
        global side
        side = 'black'
        self.for_black.configure(fg='white', bg='deepskyblue')
        self.for_white.configure(fg='black', bg='white')

    def click_for_white(self):
        global side
        side = 'white'
        self.for_white.configure(fg='white', bg='deepskyblue')
        self.for_black.configure(fg='black', bg='white')

    def click_white_up(self):
        global upper_chess
        upper_chess = 'white'
        self.white_up.configure(fg='white', bg='deepskyblue')
        self.black_up.configure(fg='black', bg='white')

    def click_black_up(self):
        global upper_chess
        upper_chess = 'black'
        self.black_up.configure(fg='white', bg='deepskyblue')
        self.white_up.configure(fg='black', bg='white')

    def click_confirm(self):
        self.win.destroy()
Esempio n. 29
0
    def __init__(self, parent, *args, **kwargs):
        tk.Frame.__init__(self, parent, *args, **kwargs)
        self.parent = parent

        # window set up
        window.resizable(False, False)
        window.title("Rock Paper Scissors by Adolfo López Herrera")

        # label header
        lbl = Label(window,
                    text="\nWelcome to Rock Paper Scissors!",
                    height=2,
                    font=("Helvetica Bold", 28))
        lbl.config(anchor=CENTER)
        lbl.pack(pady=10)

        # setting window size
        window.geometry('500x500')

        # initial output isn't set to anything
        self.output = tk.StringVar()
        self.output.set("??")

        # output label
        output_lbl = Label(window,
                           textvariable=self.output,
                           font=("Helvetica Bold", 100),
                           height=2)
        output_lbl.config(anchor=CENTER)
        output_lbl.pack()

        # buttons
        window.grid_columnconfigure(0, weight=1)
        window.grid_columnconfigure(4, weight=1)

        btn1 = Button(window,
                      text="✊",
                      bg="black",
                      width=100,
                      height=100,
                      borderless=1,
                      font=("Helvetica", 40),
                      command=self.Rock)
        btn1.grid(row=0, column=1)
        btn1.pack(padx=33.3333333333, pady=0, side=tk.LEFT)

        btn2 = Button(window,
                      text="✋",
                      bg="black",
                      width=100,
                      height=100,
                      borderless=1,
                      font=("Helvetica", 40),
                      command=self.Paper)
        btn2.grid(row=0, column=2)
        btn2.pack(padx=33.3333333333, pady=0, side=tk.LEFT)

        btn3 = Button(window,
                      text="✌️",
                      bg="black",
                      width=100,
                      height=100,
                      borderless=1,
                      font=("Helvetica", 40),
                      command=self.Scissor)
        btn3.grid(row=0, column=3)
        btn3.pack(padx=33.3333333333, pady=0, side=tk.LEFT)
Esempio n. 30
0
task_one_title.pack()

task_one_description = Label(task_one_frame, text='Please select size of array and generation option')
task_one_description.pack()

input_frame = Frame(task_one_frame)
input_frame.pack(pady=20)

task_one_size_label = Label(input_frame, text='size', fg='grey')
task_one_size_label.pack(side=LEFT)

size_input = Entry(input_frame)
size_input.pack(side=LEFT)

button_zero_to_one = MacosButton(task_one_frame, text='with zero to one', command=task_1_action_1)
button_zero_to_one.pack(pady=10)

button_two = MacosButton(task_one_frame, text='with -10 to 10', command=task_1_action_2)
button_two.pack(pady=5)

button_three = MacosButton(task_one_frame, text='with 0 to 50', command=task_1_action_3)
button_three.pack(pady=5)

generated_array_label = Label(task_one_frame, text='Generated array will be here')
generated_array_label.pack()

result_label = Label(task_one_frame, text='Result will be displayed here')
result_label.pack(pady=20)

# Task two layout