Initial commit with README

This commit is contained in:
GVSADS
2026-01-25 17:01:16 +08:00
commit 246bbd8fd9
106 changed files with 2071 additions and 0 deletions

BIN
sys/lib/setting/ICO.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@@ -0,0 +1,98 @@
from tkinter import Tk,Button,Canvas,messagebox,OptionMenu,StringVar
from os import startfile,path,getcwd,system
from sys import exit as ex
#----------Made by 悠然自得、添亮了(肝肝甘甘的野生电脑)----------#
#设置尺寸为None值
chicun = None
# 创建主窗口
root = UI.Window()
#创建调整大小窗口
root2 = UI.Window()
#暂时隐藏副窗口
root2.withdraw()
#设置尺寸
root.geometry("400x300")
root2.geometry("100x150")
#标题设置
root.title("设置")
#设置背景色
root.configure(background='gray')
root2.configure(background='gray')
#不可放大缩小:设置
root.resizable(width=False, height=False)
root2.resizable(width=False, height=False)
def Button1():
global chicun
chicun = '500x300'
root2.withdraw()
def Button2():
global chicun
chicun = '750x450'
root2.withdraw()
def Button3():
global chicun
chicun = '1000x600'
root2.withdraw()
#副窗口按钮
button1 = Button(root2.Widget, text="500x300",overrelief='sunken',bd=4,command=Button1)
button1.pack(side="top", pady=8)
button2 = Button(root2.Widget, text="750x450",overrelief='sunken',bd=4,command=Button2)
button2.pack(side="top", pady=8)
button3 = Button(root2.Widget, text="1000x600",overrelief='sunken',bd=4,command=Button3)
button3.pack(side="top", pady=8)
def open4():
root = UI.Window()
root.withdraw()
messagebox.showinfo('操作系统信息',f'名称MikOS \n版本号{Kernel["VerSion"]}\nPowered by Python Tkinter\n© 2023 G Dev Hub MikOS Dev Team')
messagebox.showinfo('终端信息', f'名称MayDOS \n版本号{DOS["VerSion"]}© 2023 MayDOS Team')
root.mainloop()
# 创建按钮
button1 = Button(root.Widget, text="设置窗口大小", command=None, width=20,overrelief='sunken',bd=4)
button2 = Button(root.Widget, text="修改背景", command=None, width=20,overrelief='sunken',bd=4)
button3 = Button(root.Widget, text="修改配置文件", command=None, width=20,overrelief='sunken',bd=4)
button4 = Button(root.Widget, text="终端", command=None, width=20,overrelief='sunken',bd=4)
button5 = Button(root.Widget, text="关于系统", command=open4, width=20,overrelief='sunken',bd=4)
# 将按钮竖着并排显示在窗口中
button1.grid(row=0, column=0, padx=40, pady=(16,0))
button2.grid(row=1, column=0, padx=40, pady=(10,0))
button3.grid(row=2, column=0, padx=40, pady=(10,0))
button4.grid(row=3, column=0, padx=40, pady=(10,0))
button5.grid(row=4, column=0, padx=40, pady=(10,0))
root2.protocol("WM_DELETE_WINDOW", root2.withdraw)
root.protocol("WM_DELETE_WINDOW",ex)
# 运行主程序
root.mainloop()

View File

@@ -0,0 +1,96 @@
from os import listdir
from tkinter import Tk, StringVar,Button,messagebox
from tkinter import ttk
from tkinter.filedialog import askopenfilename
from sys import exit as ex
#----------Made by 悠然自得、添亮了(肝肝甘甘的野生电脑)----------#
# 创建主窗口
root = Tk()
root.title("修改背景")
#设置背景色
root.configure(background='gray')
#设置大小及不可缩放
root.geometry("200x100")
root.resizable(width=False, height=False)
# 读取BG文件夹内容
try:
bg_files = listdir("bg")
except:
bg_files = listdir("../bg")
# 创建下拉菜单并添加选项
selected_bg = StringVar(value=bg_files[0])
bg_dropdown = ttk.Combobox(root, textvariable=selected_bg, values=bg_files,state='readonly')
bg_dropdown.place(x=20,y=20)
def get_new_img():
main_img = askopenfilename(initialdir='C:/Users/', filetypes=[('图片', '*.png;*.jpg;*.jpeg;*.bmp;')])
if main_img == '' or main_img == None:
print('Debug:检测到路径失效或关闭路径选择窗口,已取消写入配置文件')
return
print('Debug:导入选择路径为:',main_img)
current_selection = bg_dropdown.get()
try:
with open("配置.txt", "r") as f:
lines = f.readlines()
lines[1] = f"{main_img}\n"
with open("配置.txt", "w") as f:
f.writelines(lines)
print(f"Debug:将 {repr(main_img)} 写入配置文件")
except:
with open("..\配置.txt", "r") as f:
lines = f.readlines()
lines[1] = f"{main_img}\n"
with open("..\配置.txt", "w") as f:
f.writelines(lines)
print(f"Debug:将 {repr(main_img)} 写入配置文件")
finally:
print('Debug:try语句资源释放成功')
messagebox.showinfo('MyOS提示', '背景修改成功!')
ex()
def modify_config():
current_selection = bg_dropdown.get()
try:
with open("配置.txt", "r") as f:
lines = f.readlines()
lines[1] = f"bg\{current_selection}\n"
with open("配置.txt", "w") as f:
f.writelines(lines)
print(f"Debug:将选项 {current_selection} 写入配置文件")
except:
with open("..\配置.txt", "r") as f:
lines = f.readlines()
lines[1] = f"bg\{current_selection}\n"
with open("..\配置.txt", "w") as f:
f.writelines(lines)
print(f"Debug:将选项 {current_selection} 写入配置文件")
finally:
print('Debug:try语句资源释放成功')
messagebox.showinfo('MyOS提示','背景修改成功!')
ex()
modify_button = Button(root, text="修改背景", command=modify_config,overrelief='sunken',bd=4,cursor='hand2')
modify_button.place(x=20, y=60)
new_img_button = Button(root,text="自定义", command=get_new_img,overrelief='sunken',bd=4,cursor='hand2')
new_img_button.place(x=86, y=60)
quit_button = Button(root, text="关闭", command=ex,overrelief='sunken',bd=4,cursor='hand2')
quit_button.place(x=140, y=60)
# 运行主循环
root.mainloop()