python – how can i open multiple windows in tkinter in another file?

i have a problem in my code in python (tkinter)
I have two files (F1.py) and (F2.py), each of which is a window, and I have another file called (main.py) that opens a window with two buttons, I want to click one of the (F1) files every time Or (F2) open.
What should I do ?
this is my code:

from tkinter import *
main = Tk()
def f1():
    import f1.py
    # I do not know what to do to run the file f1.py here !! 
def f2():
    import f2.py
    # I do not know what to do to run the file f2.py here !! 
btn_f2 = Button(main,text="open f2",command=f2).pack()
btn_f1 = Button(main,text="open f1",command=f1).pack()
mainloop()

Product of the Month September 2016

Source link

Leave a Comment

Your email address will not be published. Required fields are marked *