#confused on how to link files in my program.

65 messages · Page 1 of 1 (latest)

analog marsh
#

os.system() runs system commands

nimble orchid
#

and ik its cus

#

yeeyyee

#

so im just confused on how to approach this

#

and diff ways

analog marsh
#

What do you want the code to do?

nimble orchid
#

so

#

i want to use the same window

analog marsh
#

You'd probably want to look into importing files as modules

nimble orchid
#

oh

#

would tht work

analog marsh
#

I'm not sure on that, unfortunately

nimble orchid
#

ye idk i this this is getting too complicated

analog marsh
#

You want the Events.py to replace the entire window?

nimble orchid
#

for a small program

#

LMFAO

#

yes

#

essentially wht i mean is

#

whe nbthe button is pressed

analog marsh
#

What's in the Events.py file?

nimble orchid
#

which will just

#

nothing so far

#

i was gona add labels

#

frames

analog marsh
#

And what libraries are you using?

nimble orchid
#

tkinter

#

for gui

#

and os

#

messageboxes

#

btu they r all tkinter

#

i feel like im making it too complicated

#

for a simple program

#

but at the same time codign everything in one file is making it harder for me to find wht im looking for

#

its just too long

#

my poitn is like there r abt 7 buttons in main menu

#

so for events section, id rather use another file yk

#

i just dont want the program to treat it as a new window

#

i can screenshare too

#

since its lil complicated

analog marsh
#

Hmm, I unfortunately don't know tkinter that well to tell you how you'd approach that

nimble orchid
#

id say its mostly a

#

python problem tho

#

since its logical rather than the gui

#

ive only used tkinter for the appearance

analog marsh
#

But you can import classes and functions from separate files

#

Without running additional files

nimble orchid
#

im just confused

#

LMFAO

#

i dont think the gui matters its just

#

instead of using 1 file u break it down into other files

#

right

#

bro i mlost

analog marsh
#

What?

#

The gui does matter, cause I don't know how you'd replace an entire view in tkinter

#

And even less how to load all that from another file

nimble orchid
#

o

#

u hide frames and show frames

#

thts all

#

hiding stuff and showing wht u want

#

ik how to do tht

#

the problem is

#

linking tht to a diff file

#

i want to do all the hiding and showing stuff in the new file

sullen mica
#

idk if you have tried it, but basically you could solve this by creating functions for building your gui in separate files. So when you want to access the second file, you basically create some kind of function to clear out the current window and then use that builder function from the another file to place elements into your window. If you have variables accosiated with that separate file you could declare them in that separate file and then import them to your main file. This is what I would do if I were you, but again, this hypothesis is completely untested so I'm not 100% sure that it works.