1

I've created a custom bitmap button using the code

PlayButton=wx.Bitmap('play.jpg', wx.BITMAP_TYPE_ANY)
self.PlayButton=wx.BitmapButton(self.bitmap, -1, PlayButton, pos=(190,300))
self.PlayButton.Bind=(wx.EVT_BUTTON, self.playGame)

Just wondering when it comes to defining my function playGame, how I could run an external python file 'game.py' in the same directory when it's clicked

1 Answer 1

1

You can import your script as module.

import game

...

def playGame(self):
    game.start()
Sign up to request clarification or add additional context in comments.

2 Comments

in this case you have to organize your script like a module. Please, share the error
When you mean to organize like a module, do I still have my imports on that script at the top and then one big function?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.