猫史档案馆


昌龙XL

昌龙XL

Lv.1

我是一条没用的小龙~

获赞:147收藏:32浏览:9374作品收藏:52

签名:紫砂中...

回复帖子评论
上一页1 页 / 共 1下一页

【Python作品分享】数据统计表 中回复

这个只是初步版本,如要最新版,请上Bilibili关注“昌龙XL”!谢谢!

2023-04-27T20:18:39 点赞:0

【社区功能反馈】用心倾听,用头发发电!(2026更新版) 中回复

希望社区加个找人awa

2023-05-19T20:09:23 点赞:0

【Python作品分享】记事本GUI【作品秀】 中回复

我来试试emotion_编程猫_点赞

 

2023-06-29T14:09:26 点赞:0

【Python作品分享】记事本GUI【作品秀】 中回复

我认为你的作品很好,可以改进一下,以下是我自己做的可以借助原生Py编程序的文本编辑工具,你可以在作品中添加像这样的实时编辑工具:

 

#Easy python
#be made by 昌龙XL

import tkinter as tk
import easygui as g
from tkinter.filedialog import askopenfilename, asksaveasfilename
import os
import subprocess

def run_cmd_Popen_fileno(cmd_string):
"""执行cmd命令"""
os.system(' start cmd.exe /K '+cmd_string)

def open_file():
try:
"""打开"""
filepath = askopenfilename(
filetypes=[("Python Files", "*.py"), ("Text Files", "*.txt")]
)
if not filepath:
return
txt_edit.delete(1.0, tk.END)
with open(filepath, "r") as input_file:
text = input_file.read()
txt_edit.insert(tk.END, text)
window.title(f"Easy Python v1.0.0 - {filepath}")
except:
g.msgbox(msg="文件打开失败",title="Easy python",ok_button="确认")


def save_file():
"""保存"""
filepath = asksaveasfilename(
defaultextension="txt",
filetypes=[("Python Files", "*.py"), ("Text Files", "*.txt")],
)
if not filepath:
return
with open(filepath, "w") as output_file:
text = txt_edit.get(1.0, tk.END)
output_file.write(text)
window.title(f"Easy Python v1.0.0 - {filepath}")

def pip():
a = g.enterbox(msg="输入库的名称",title="Easy Python")
if a == None:
ts = 0
else:
a1 = "pip install "+str(a)
run_cmd_Popen_fileno(a1)

def open_cmd():
"""打开cmd"""
os.system('start cmd.exe')


window = tk.Tk()
window.title("Easy Python v1.0.0 ")
window.rowconfigure(0, minsize=400, weight=1)
window.columnconfigure(1, minsize=400, weight=1)

txt_edit = tk.Text(window)
fr_buttons = tk.Frame(window, relief=tk.RAISED, bd=2)
btn_open = tk.Button(fr_buttons, text="打开", command=open_file)
btn_save = tk.Button(fr_buttons, text="保存", command=save_file)
btn_pip = tk.Button(fr_buttons, text="安装库", command=pip)
btn_cmd = tk.Button(fr_buttons, text="终端", command=open_cmd)

btn_open.grid(row=0, column=0, sticky="ew", padx=5, pady=5)
btn_save.grid(row=1, column=0, sticky="ew", padx=5, pady=5)
btn_pip.grid(row=2, column=0, sticky="ew", padx=5, pady=5)
btn_cmd.grid(row=3, column=0, sticky="ew", padx=5, pady=5)


fr_buttons.grid(row=0, column=0, sticky="ns")
txt_edit.grid(row=0, column=1, sticky="nsew")

window.mainloop()

2023-06-29T14:14:58 点赞:0

贪吃蛇python 中回复

?喵喵喵?(这个喵是自己打的)

2023-06-29T14:16:22 点赞:0

【Kitten N公测开始】我来啦我来啦!我带着三端合一走来啦! 中回复

一点也不好用,还是kitten4好

2023-07-14T13:54:45 点赞:2

【CoCo V1.21版本更新】叮叮叮~ 云存储控件大升级!快来围观! 中回复

编程猫我吃柠檬,做的东西全因为一个不稳定的控件没了!!!

2024-09-17T20:10:49 点赞:1