Python 使用记事本打开txt,崩溃,但当我使用Tkinter制作的GUI时,升华文本2是正常的
我用Tkinter制作了一个GUI。当我点击它时,我设置了一个按钮来打开一个Python 使用记事本打开txt,崩溃,但当我使用Tkinter制作的GUI时,升华文本2是正常的,python,tkinter,Python,Tkinter,我用Tkinter制作了一个GUI。当我点击它时,我设置了一个按钮来打开一个txt文件。当txt的默认打开模式是sublime text2时,GUI工作得很好。但是当我将txt的默认打开模式改为windows记事本,我就知道了,GUI将崩溃。GUI将一直工作到我关闭txt文件 # -*- coding: utf-8 -*- from Tkinter import * import tkFont import os class System(object): """docstring f
txt文件
。当txt
的默认打开模式是sublime text2
时,GUI工作得很好。但是当我将txt
的默认打开模式改为windows记事本
,我就知道了,GUI将崩溃。GUI将一直工作到我关闭txt文件
# -*- 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()
下面的图表崩溃了
当我关闭txt
文件时,它又起作用了。但是升华文本2是正常的。那么为什么?……我怎么解决这个问题呢?我想做一个exe,所以大多数人都想用记事本打开一个txt文件。doc:“这个功能已经过时了。请使用子流程模块。”请参阅: