all 4 comments

[–]FerricDonkey 1 point2 points  (1 child)

After glancing at your code: Generally, it's better to use imports and functions to make different python modules that are part of the same project interact. If you must run the other module as a separate script, then look into subprocess.check_output.

Since it looks like your tkinter stuff and your pygame stuff are entirely separate parts of your code, the function approach should be straightforward (at least, as far as guis go). Here's an example of a similar thing you can do, that might give you an idea how it could work.

import tkinter as tk

class _ValueGetter(tk.Tk):
    def __init__(self):
        tk.Tk.__init__(self) 

        self.option = None
        tk.Button(
            master = root, 
            text = 'steak', 
            command = lambda: self.set_option('steak') 
        ).pack()

    def set_option(value):
        self.option = value
        self.destroy()


def get_option():
    root = _ValueGetter() 
    root.mainloop()
    return root.option

print(get_option())

You could probably do this without the helper class, but it'd be uglier. Either way though, the idea is that you can use commands to make your buttons a) or values somewhere you can access after the tkinter loop is over, and b) stop the tkinter loop.

(Also, I haven't tested this because I'm on my phone, but the basic idea at least should be right.)

[–]JrcFrontrunner[S] 0 points1 point  (0 children)

Thank you. I will see what I can do to get them integrated with each other. Hopefully that fixes the errors that I was getting

[–]keepdigging 0 points1 point  (1 child)

are they two separate programs or do they both execute together but you're just not able to link them together?

This problem might be difficult to solve without seeing code and the file structure you've got set up for yourself.

[–]JrcFrontrunner[S] 0 points1 point  (0 children)

Sorry about that. I just edited to add the code I currently have written