用户:!@查看:0 回复:0 评论:0 创建时间:2023-04-08T17:12:22
【作品展示】

【作品介绍】
PythonIDE,非常好用,带你体验大自然般的超棒写代码环境10后python能力比较强想一起做程序的喵🛰:liwupresent7~
处理器最好i5以上,有能力的话i9更好(我八核i7😅)
【作品源代码】
import tkinter as tk
from tkinter import *
from tkinter.scrolledtext import ScrolledText
from tkinter.filedialog import *
import idlelib.colorizer as idc
import idlelib.percolator as idp
def SKY_IDE(title:str=...) -> None:
root = tk.Tk()
root.title("Sky IDE")
root.geometry('1000x1000')
#root.attributes('-fullscreen',True)
frame = tk.Frame(root)
button = tk.Button(frame, text='Exit Sky IDE', bg='#252424', fg='#D4F2E7')
button1 = tk.Button(frame, text='New', bg='#252424', fg='green')
button2 = tk.Button(frame, text='Open', bg='#252424', fg='#AFEEEE')
button3 = tk.Button(frame, text='Save', bg='#252424', fg='skyblue')
button4 = tk.Button(frame, text='▶', bg='#252424', fg='#7FFFAA')
button5 = tk.Button(frame, text='Clean run board 3', bg='#252424', fg='#A3DAAA')
button6 = tk.Button(frame, text='■', bg='#252424', fg='#98FB98')
button7 = tk.Button(frame, text='About', bg='#252424', fg='green')
button.pack(side=tk.LEFT)
button1.pack(side=tk.LEFT)
button2.pack(side=tk.LEFT)
button3.pack(side=tk.LEFT)
button4.pack(side=tk.LEFT)
button6.pack(side=tk.RIGHT)
button5.pack(side=tk.RIGHT)
button7.pack(side=tk.RIGHT)
frame.pack(side=tk.TOP, fill=tk.BOTH)
global textPad
textPad = ScrolledText(bg='#252424', fg='skyblue', font=('Arial', 16))
textPad.pack(fill=tk.BOTH, expand=1)
textPad.focus_set()
global filename
filename = 'demo.py'
def btnfunc01():
global textPad, filename
textPad.delete(1.0, tk.END)
filename = 'demo.py'
def btnfunc02():
global textPad, filename
filename2 = askopenfilename(defaultextension='.py')
if filename2 != '':
textPad.delete(1.0, tk.END)
f = open(filename2, 'r', encoding='utf-8', errors='ignore')
textPad.insert(1.0, f.read())
f.close()
filename = filename2
def btnfunc03():
global textPad, filename
filename = asksaveasfilename(initialfile=filename, defaultextension='.py')
if filename != '':
fh = open(filename,'w', encoding='utf-8', errors='ignore')
msg = textPad.get(1.0, tk.END)
fh.write(msg)
fh.close()
button['command'] = lambda: root.destroy()
button1['command'] = lambda: btnfunc01()
button2['command'] = lambda: btnfunc02()
button3['command'] = lambda: btnfunc03()
frame2 = tk.LabelFrame(root, text='python 3', height=100)
frame2.pack(fill=tk.BOTH, expand=1)
global textMess
textMess = ScrolledText(frame2, bg='#252424', height=10)
textMess.pack(fill=tk.BOTH, expand=1)
def clearMess():
global textMess
textMess.delete(1.0, tk.END)
def colorprint(txt, color='black'):
global textMess
if textMess != None:
if color != 'black':
textMess.tag_config(color, foreground=color)
textMess.insert(tk.END, txt, color)
textMess.see(tk.END)
def goto():
global textPad, textMess
try:
msg = textPad.get(1.0, tk.END)
mg = globals()
ml = locals()
exec(msg, mg, ml)
except Exception as e:
colorprint('\n' + str(e) + '\n', 'red')
button4['command'] = lambda: goto()
button5['command'] = lambda: clearMess()
button7['text'] = "Zack Wang"
idc.color_config(textPad)
textPad.focus_set()
textPad.config(bg='#87CEFA', fg='green')
p = idp.Percolator(textPad)
d = idc.ColorDelegator()
p.insertfilter(d)
root.mainloop()
return None
if __name__ == "__main__":
SKY_IDE()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn