Jul-20-2020, 11:09 PM
@DPaul: didn't know about subprocess, will look into it, thank you! And yes it was tricky. For me the worst part is converting my "makehtml" functions, which work well in a bash terminal, to work in a tkinter window. It's a whole different kettle of fish! But menator01 put me on the right path, so now I am slowly working through all my functions to make them work in tkinter. I even saw ways to improve them!
@menator01: thanks, I will look at your code later today, see if I can understand it. I never used classes before!
There are 2 simple ways to solve this problem:
1. call the program that opens a new window with os.system
Import this module in the master window. Then all the functions are available.
I just know it works!
@menator01: thanks, I will look at your code later today, see if I can understand it. I never used classes before!
There are 2 simple ways to solve this problem:
1. call the program that opens a new window with os.system
top=Tkinter.Tk() def helloCallBack(): os.system('python SendEmail.py') B=Tkinter.Button(top,text="hello",command= helloCallBack) B.pack() top.mainloop()You just have to make sure the program you want to open is in the system path:
import sys # to import the files we need the paths path = '/home/pedro/myPython/myModules/' # append the paths sys.path.append(path)2. What I did: put all the programs in a module, in my case guiHTML.py Again, the module must be in the system path, or it won't be found.
Import this module in the master window. Then all the functions are available.
import guiHTMLPut a function like this in the master window:
def openImages(): #call the images function defined in the guiHTML module guiHTML.images()and link it to a button:
btn3 = tk.Button(frame1, text='open insert image', command=openImages) btn3.grid(columnspan=2, column=0, row=2, sticky='w', pady=10)Now, I don't know what you people who learned programming properly think about this way of doing it and I would be happy to hear suggestions for improvement.
I just know it works!