

Random_num = random.randint(18, 25) # picks a random numberįor i in range(random_num): # loops round a number of times set by the random number Messagebox.showwarning("Missing Names", "One or more of the boxes hasnt been filled in, please correct this.") Player2_name = entry_2.get() # gets the string from entry box 2 Player1_name = entry_1.get() # gets the string from entry box 1

P1_colour_nfig(text="Red", fg="#FF0000") # switches coloursĭef start_play(): # function for when play is presses P2_colour_nfig(text="Yellow", fg="#FFFE00") # switches colours P2_colour_nfig(text="Red", fg="#FF0000") # switches colours P1_colour_nfig(text="Yellow", fg="#FFFE00") #switches colours If p1_colour_label = "Red": # if the label has text red Label_2.place(x=575, y=290) # places labelĮntry_2 = Entry(menu_page, width=40) # details for entry boxĮntry_2.place(x=745, y=300) # places entry boxĭef exit_menu(): # function for when exit is pressedĮxit_button_photo = PhotoImage(file=r"Z:\Finley\School\Sixth Form\CS\Projects\Connect 4\Images\exit_menu.png") # opens the image to be usedĮxit_button = Button(menu_page, image=exit_button_photo, command=exit_menu) # closes the login and opens menuĮxit_ace(x=1320, y=781) # places buttonĭef toggle(): # function to change the colour and text of label next to the players Label_2 = Label(menu_page, text="Player 2 Name:", font=("Comic Sans MS", "16"), bg="#E4D6B6") # details for label Label_1.place(x=575, y=220) # places labelĮntry_1 = Entry(menu_page, width=40) # details for entry boxĮntry_1.place(x=745, y=230) # places entry box Label_1 = Label(menu_page, text="Player 1 Name:", font=("Comic Sans MS", "16"), bg="#E4D6B6") # label details

Title_ace(x=600, y=20) # places the label Title_label = Label(menu_page, image=title_label_photo, bg='#E4D6B6') # label details Title_label_photo = PhotoImage(file=r"Z:\Finley\School\Sixth Form\CS\Projects\Connect 4\Images\connect_4_title.png") Image_open = Image.open("Z:\Finley\School\Sixth Form\CS\Projects\Connect 4\Images\main_background.gif") #change to where the picture isīg = Label(image=image) #makes the label the imageīg.place(x=-10, y=-10) #places the label in the background Menu_page.resizable(False,False) #stops resizing of the menu_page Menu_page.attributes("-fullscreen", True) #makes the menu_page fullscreen Menu_page.title("Enter Names") #titles the menu_page I have the below code: from tkinter import * # imports all from tkinterįrom tkinter import messagebox # imports messageboxįrom PIL import ImageTk, Image #imports pillow for images
