Basically I have created a pygame menu for my game and it will load all other pygame windows when I click on them, however for some aspects like adding a user and so on,
I created in a Tkinter GUI. When I click to load them on my pygame it won't load the Tkinter GUI, does anyone know how I can solve this or if there's something I need to add in to make it work.
It acts as if its going to load something but doesn't, the first one called "mathsvaders" loads fine as it a pygame program, but the high-score is in tkinter and doesn't load:
...
pos = 1
while True:
#events
for e in pygame.event.get():
if e.type == pygame.QUIT:
pygame.quit()
sys.exit()
elif e.type == pygame.KEYDOWN:
if e.key == pygame.K_DOWN:
pos += 1
if pos > 5:
pos = 1
elif e.key == pygame.K_UP:
pos -= 1
if pos < 1:
pos = 5
elif e.key == pygame.K_RETURN:
if pos == 1:
import MathsvadersReal
elif e.key == pygame.K_RETURN:
if pos == 2:
import Highscore
elif pos == 5:
pygame.quit()
sys.exit()
The code for the form is as follows:
import Tkinter import Databaseconnector
class simpleapp_tk(Tkinter.Tk):
def __init__(self,parent):
Tkinter.Tk.__init__(self,parent)
self.parent = parent
self.initialize()
def initialize(self):
def create_widgets(self):
# create welcome label
label1 = Tkinter.Label(self, text = "Hello world")
label1.grid(row = 0, column = 2, columnspan = 4, sticky = 'E')
if __name__ == "__main__":
app = simpleapp_tk(None)
app.title('my application')
app.geometry("250x200")
app.mainloop()