1

So I have 2 Python files, one is a PyGame game (just a movement game) and the other is a Tkinter form. The game has a variable called MOVESPEED and I would like the Tkinter form to change it whenever needed.

The form currently has an entry box (where you will put the value of "MOVESPEED") and a button which will submit that value, once that button is pushed, I would like it so somehow change MOVESPEED in the pygame file. (This change does not need to be permanent)

Thank you for any help, I'll give you more info if need be.

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
  • Perhaps this helps: http://stackoverflow.com/questions/2524031/python-tkinter-connect-variable-to-entry-widget – ρss Dec 03 '14 at 10:05
  • So, what is the problem? Have you tried `import pygame_module` and `pygame_module.MOVESPEED = stuff`? Or do you want to change it _in the code_? If so, why? – tobias_k Dec 03 '14 at 10:29
  • @tobias_k will that change it for the file that has MOVESPEED in it? or for the file that is importing it? – user2322122 Dec 03 '14 at 20:10
  • @tobias_k I tried to do this with 2 other files, one file set's x, then prints it every 1 second, i then made another file which imported it and set it to another number, but it just runs it as if it were the file i was trying to change. – user2322122 Dec 03 '14 at 20:16
  • Did you run those two files in the same python instance? In this case, it should work, but if you are changing that number from _another_ python instance, then you should consider storing those numbers is an external text file. – tobias_k Dec 03 '14 at 20:24
  • Separate instances, I really didn't want to use external files >. – user2322122 Dec 04 '14 at 06:57

0 Answers0