I am new to Python programming, and i am trying to build a form of game collection to aid autistic children, where the games can be accessed from a GUI application which has on it an image and name of the game with a play button next to each game.
the problem i have is that when i am pressing the relevant chosen game button the game that opens is the last that was imported to the application. The buttons, images and text are on a canvas on a GUI Tkinter window and what i would like to do is to try to make different callback functions that when called from the relevant button it will open the appropriate game.
The code for one of the images , text and buttons is as below
#Placing of the third Activity game name img2 = PhotoImage(file=imgdir +'colorme(1).gif') can.create_image(1, 130, image=img2, anchor=NW) can.image = img2 # reference to keep image can.create_text(180, 153, text='ColorFill Activity Game', fill='blue', font=('Arial',14)) button2 = Button(Gui, text = "Play", anchor = NW) button2.configure(activebackground = "#33B5E5", fg='red', font=('Arial', 14), relief = RAISED, command = Button2CallBack ) button2_window = can.create_window(320, 135, anchor=NW, window=button2)
the Button2Callback is one of the function that i am trying to create that would handle the opening of the required game once called. In the top part of the application i thing i have imported all the required scripts as follows
from tkinter import * from tkinter.messagebox import * from tkinter import Image from Tetrisino import * from colorfill import * from Simulation import * import os
I would appreciate any help that could be given as i am stuck and it could be that i may be doing something wrong from my side or even calling the button command in the wrong method or way.
It looks like you're new here. If you want to get involved, click one of these buttons!