简体   繁体   中英

tkinter GUI will not open when pysftp imported

I'm working on a Programm where the User can insert data via a tkinter GUI, than they are saved in a JSON and after this uploaded to a server via sftp. When i start the file in pycharm all worked as designed.

But when i try it via doubleclick on the .py file, only the command line opens for a second, but not the GUI. I did some testing and found out, that this only happened, when i import pysftp.

Here the simple program i used for testing, which worked fine:

from tkinter import *
root = Tk()
mainframe = Frame(root)
mainframe.pack()
mainframe.grid()
root.mainloop()

But if i do this:

from tkinter import *
import pysftp
root = Tk()
mainframe = Frame(root)
mainframe.pack()
mainframe.grid()
root.mainloop()

than the above mentioned happened. I use Python 3.6 and the latest pysftp version.

Have anyone an Idea why this is happening? Thanks

You need to package your application using cx_freeze or py2exe. I would recommend py2exe.

Make an executable and then try double clicking on it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM