大家好,我是小骷髅SKELETY。
本期给大家带来的特别版本2.0系列第一集为:
用PYTHON做一个类似VSCODE的PYTHON编辑器
这个文章十分的好水
- 版本号:1.0
- 脚本语言:Python
- 支持脚本语言:Python
更新预告:
将更新LazyPyConsole的1.1版本
更新日志:
- LazyPyConsole 1.0: 支持Python
- LazyConsole 1.1 支持Java、Python,UI设计更新,需要启动器启动。
需要准备:
- Python3.0 (lpc1.0, 1.1, 1.2)
- Java16 (lpc1.1, 1.2)
- Windows/Mac/Linux 电脑1台
文件分布:
LazyPyConsole
- LazyPyConsole.py
-
- Libs
-
-
- assets
-
-
-
-
- lang
-
-
-
-
-
-
- lang.py
-
-
-
-
-
-
- Major
-
-
-
-
-
-
- Settings.py
-
-
-
-
-
- lpcLibs
-
-
-
-
- .md
-
-
好啦 废话不多说 我们 来看代码吧!
(LazyPyConsole.py)
#Import the model that we need
import os
import time
import codeop
from Libs.assets.lang import lang
from Libs.assets.Major import Settings
from tkinter.filedialog import *
from tkinter.messagebox import *
from subprocess import *
from tkinter import *
t = Tk()
#Default FileName
filename = ""
#Read Language File
title = lang.suggest.get("title")
save = lang.suggest.get("file_save")
read = lang.suggest.get("file_read")
filed = lang.suggest.get("file_OP")
helpd = lang.suggest.get("help_OP")
author = lang.suggest.get("help_author")
quits = lang.suggest.get("help_quits")
bkg = Settings.suggest.get("background")
ftg = Settings.suggest.get("fontground")
ibg = Settings.suggest.get("insertbackground")
#Set the default settings
t.title(title)
t.geometry("1500x800")
#The callables that we used
def runscript(getfunc):
os.system("python "+filename)
def saveFile():
global filename
filename = asksaveasfilename()
try:
agree_file = open(filename,"w")
agree_file.write(tps.get(1.0,"end"))
agree_file.close()
t.title(title +"-("+ filename +")")
showinfo(title, "FileSave Task Completed.")
except FileNotFoundError:
showerror(title, "SaveError. You can't already to save a file and then close this windows gui!")
def readFile():
global filename
filename = askopenfilename()
try:
agree_file = open(filename)
chars = agree_file.read()
t.title(title +"-("+ filename +")")
tps.insert("end",chars)
except FileNotFoundError:
showerror(title, "OpenError. You can't already to save a file and then close this windows gui!")
def author():
print("Watch Author and Infos on File: Libs\lpcLibs\.md")
def quitme():
t.quit()
quit("LazyPyConsole.py")
#Type String
tps = Text(t, font=("Consolas",16), background=bkg, fg=ftg, insertbackground=ibg)
tps.pack()
#MenuLabel
file = Menu(t, tearoff=0)
file.add_command(label=save,command=saveFile)
file.add_command(label=read,command=readFile)
help = Menu(t, tearoff=0)
help.add_command(label=author,command=author)
help.add_command(label=quits,command=quitme)
op = Menu(t)
op.add_cascade(label=filed,menu=file)
op.add_cascade(label=helpd,menu=help)
t.config(menu=op)
#KeyListener Button Bind Main
t.bind("<Control-F5>",runscript)
#MainLoop The Windows
t.mainloop()
模块:
(lang.py)
#PS: 这是文字, 你可以修改语言, 比如汉化SaveFile就把SaveFile改成你想修改的比如(保存文件)
suggest = {
"title": "LazyPyConsole[Operator]",
"file_save": "SaveFile",
"file_read": "ReadFile",
"file_OP": "file",
"help_OP": "help",
"help_author": "Author",
"help_quits": "Quit"
}
(Settings.py)
suggest = {
"background": "black",
"fontground": "white",
"insertbackground": "white"
}
(.md)
#这就是介绍 写的模糊不清,乱七八糟的请谅解 谢谢
My Infos
Hello Guys! Welcome To My Big ProJect: LazyPyConsole. It is a copy of python’s official idle code.
I’m LvLOG. now upload videos on B Station.
I have so much account in my life.
Like “Netease YouDao Kada”, Like “Create world Together”, Like “Alpha Club”…
EnJoy It!
ProJect’s Info
This ProJect Is a Big ProJect better than before.
It can run python scripts but can’t run without terminal.
喜欢吗?
点个免费的赞吧 你可以随时改变主意
另外,骷髅祝大家我自己
暑假快乐!
再见awa!