예제 #1
0
    def back():
        typing_clip.stop()
        clip.stop()
        try:
            helproot
        except NameError:
            helproot_exists = False
        else:
            helproot_exists = True

        try:
            helproot1
        except NameError:
            helproot1_exists = False
        else:
            helproot1_exists = True

        try:
            helproot2
        except NameError:
            helproot2_exists = False
        else:
            helproot2_exists = True

        if helproot_exists:
            helproot.destroy()
        if helproot1_exists:
            helproot1.destroy()
        if helproot2_exists:
            helproot2.destroy()

        root3.destroy()
        main_window.deiconify()
        methods.type(main_window, menuclip, typing_clip, music_playing)
예제 #2
0
    def back():
        pygame.display.quit()
        typing_clip.stop()
        clip.stop()
        try:
            helproot
        except NameError:
            helproot_exists = False
        else:
            helproot_exists = True

        if helproot_exists:
            helproot.destroy()
        root.destroy()
        main_window.deiconify()
        methods.type(main_window, menuclip, typing_clip, music_playing)
예제 #3
0
파일: Menu.py 프로젝트: farhanlion/Newt
def helpme():
    global helproot
    try:
        helproot
    except NameError:
        helproot = methods.helpwindow(master, 4)
    else:
        if helproot.winfo_exists() == 0:
            helproot = methods.helpwindow(master, 4)
        else:
            helproot.deiconify()

    creditroot_exists = checkcreditroot()
    if creditroot_exists:
        creditroot.destroy()
        music_playing = checkmusic()
        methods.type(main_window, clip, typing_clip, music_playing)
예제 #4
0
 def back():
     creditsclip.stop()
     root.destroy()
     methods.type(main_window, menuclip, typing_clip, music_playing)
예제 #5
0
파일: Menu.py 프로젝트: farhanlion/Newt
def window():
    global main_window, music_on

    main_window = Tk()
    methods.centralise(main_window, 1000, 580)
    main_window.title("Newton's Laws of Motion")
    main_window.iconbitmap("images/newticon.ico")
    main_window.wm_attributes("-topmost", False)

    main_window.resizable(0, 0)
    background = ImageTk.PhotoImage(Image.open('images/bluepixels.png'))
    panel = Label(main_window, image=background)
    panel.pack(side='top', fill="both", expand="yes")
    panel.image = background

    main_window.protocol("WM_DELETE_WINDOW", close_window)

    newtlabelx = Label(main_window,
                       text="WELCOME TO NEWT",
                       font=("Comic Sans MS", 37),
                       fg='white',
                       bg='royalblue4',
                       relief=SUNKEN,
                       bd=5,
                       width=18,
                       height=1)
    newtlabelx.place(relx=0.1, rely=0.2)

    newton1_button = Button(main_window,
                            text="Newton's First Law",
                            bd=3,
                            bg='royalblue1',
                            width=30,
                            height=1,
                            font=("Comic Sans MS", 12),
                            fg='white',
                            command=first_law)
    newton1_button.place(relx=0.1, rely=0.45)

    newton2_button = Button(main_window,
                            text="Newton's Second Law",
                            bd=3,
                            bg='royalblue2',
                            width=30,
                            height=1,
                            font=("Comic Sans MS", 12),
                            fg='white',
                            command=second_law)
    newton2_button.place(relx=0.1, rely=0.522)

    newton3_button = Button(main_window,
                            text="Newton's Third Law",
                            bd=3,
                            bg='royalblue3',
                            width=30,
                            height=1,
                            font=("Comic Sans MS", 12),
                            fg='white',
                            command=third_law)
    newton3_button.place(relx=0.1, rely=0.594)

    quiz_button = Button(main_window,
                         text="Mini Quiz",
                         bd=3,
                         bg='royalblue4',
                         width=30,
                         height=1,
                         font=("Comic Sans MS", 12),
                         fg='white',
                         command=quizz)
    quiz_button.place(relx=0.1, rely=0.667)

    exit_button = Button(main_window,
                         text="Exit",
                         bd=4,
                         bg='lightblue2',
                         width=6,
                         height=1,
                         font=("Comic Sans MS", 12),
                         fg='royalblue4',
                         command=close_window)
    exit_button.place(relx=0.9, rely=0.05)

    help_button = Button(main_window,
                         text="Help",
                         bd=4,
                         bg='lightblue2',
                         width=4,
                         height=1,
                         font=("Comic Sans MS", 12),
                         fg='royalblue4',
                         command=helpme)
    help_button.place(relx=0.84, rely=0.05)

    credits_button = Button(main_window,
                            text="Credits",
                            bd=4,
                            bg='lightblue2',
                            width=6,
                            height=1,
                            font=("Comic Sans MS", 12),
                            fg='royalblue4',
                            command=creditsto)
    credits_button.place(relx=0.76, rely=0.05)

    # Def Music On:

    def musicon():
        clip.play()
        music_on.config(state=DISABLED, fg="grey")
        music_off.config(state=NORMAL, fg="white")

    # Def Music Off:

    def musicoff():
        clip.stop()
        music_on.config(state=NORMAL, fg="white")
        music_off.config(state=DISABLED, fg="grey")

    # Music
    music_label = Label(main_window,
                        text="Music Status:",
                        font=("Comic Sans MS", 14),
                        fg='royalblue4',
                        bg='lightblue2',
                        height=1)
    music_label.place(relx=0.082, rely=0.051, anchor=CENTER)

    music_on = Button(main_window,
                      text="ON",
                      relief=RAISED,
                      fg='white',
                      command=musicon,
                      font=("Comic Sans MS bold", 10),
                      width=6,
                      bg='royalblue4',
                      bd=3,
                      state=DISABLED)
    music_on.place(relx=0.051, rely=0.1183, anchor=CENTER)

    music_off = Button(main_window,
                       text="OFF",
                       relief=RAISED,
                       fg='white',
                       command=musicoff,
                       font=("Comic Sans MS bold", 10),
                       width=6,
                       bg='royalblue4',
                       bd=3,
                       state=NORMAL)
    music_off.place(relx=0.112, rely=0.1183, anchor=CENTER)
    music_playing = True
    # Typewriter
    newtlabeltw = Label(main_window,
                        text="Do You Know?",
                        relief='ridge',
                        bd=5,
                        font=("Comic Sans MS", 16),
                        fg='white',
                        bg='royalblue4')
    newtlabeltw.place(relx=0.1, rely=0.8)

    methods.type(main_window, clip, typing_clip, music_playing)