I make a GUI with Tkinter.And I set a button to open a txt file
when I click it.When the default open mode of txt
is sublime text2
,the GUI works well.But when I change the default open mode of txt
to windows notepad
,the GUI will crash.And the GUI will work ubtil I close the txt file.
# -*- coding: utf-8 -*-
from Tkinter import *
import tkFont
import os
class System(object):
"""docstring for system"""
def __init__(self):
self.root = Tk()
self.b1 = Button(self.root,text = 'open a ui.txt ',command = self.openfile)
self.b1.pack()
self.root.mainloop()
def openfile(self):
os.popen('ui.txt')
if __name__ == '__main__':
System()
The chart below had crashed.
When I close txt
file.It worked again.But sublime text2 is normal.So why?……How can I solve this situation?I want to make a exe,so most people want to open a txt file with notepad.