手機純文本編輯器下載,手機python文本編輯器下載_python寫的一個文本編輯器

 2023-11-16 阅读 26 评论 0

摘要:代碼如下:手機純文本編輯器下載。#!/usr/bin/env python#-*- coding: utf-8 -*-python 文本編輯器?#================================&

代碼如下:

手機純文本編輯器下載。#!/usr/bin/env python

#-*- coding: utf-8 -*-

python 文本編輯器?#=============================================================================

#???? FileName:

python用什么編譯器,#???????? Desc:

#?????? Author: ToughGuy

#????? Version: 0.0.1

#?? LastChange: 2013-02-20 14:52:11

#????? History:

#=============================================================================

from Tkinter import *

import tkMessageBox,tkFileDialog

import platform

# nl = os.linesep

def openfile():

global filename???????????? # 使用global聲明為全局變量,方便后邊的程序調用

systype = platform.system() # 判斷系統類型

if systype == 'windows':

basedir = 'c:'

else:

basedir = '/'

filename = tkFileDialog.askopenfilename(initialdir=basedir)

try:

fobj_r = open(filename, 'r')

except IOError, errmsg:

print '*** Failed open file:', errmsg

else:

editbox.delete(1.0, END)

for eachline in fobj_r:

editbox.insert(INSERT, eachline)

fobj_r.close()

def savefile():

save_data = editbox.get(1.0, END)

try:

fobj_w = open(filename, 'w')

fobj_w.writelines(save_data.encode('utf-8'))

fobj_w.close()

tkMessageBox.showinfo(title='提示',

message='保存成功')

except IOError, errmsg:

tkMessageBox.showwarning(title='保存失敗', message='保存出錯??? ')

tkMessageBox.showwarning(title='錯誤信息', message=errmsg)

except NameError:

tkMessageBox.showwarning(title='保存失敗', message='未打開文件')

def showlinenum():

tkMessageBox.showinfo(title='提示',

message='這個功能作者現在不會寫,放這里裝飾用的.')

def destroy_ui(ui):

ui.destroy()

def aboutauthor():

author_ui = Toplevel()

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/3/173611.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息