我正在基于python / C#(两种语言都开放)制作基于文本的程序,并且必须具有GUI。该程序始终处于全屏状态。我已经尝试过wxpython(太复杂了,花了5个小时来制作一页,每个对象都是5-10行代码)和winforms(对于全屏显示来说不是最佳选择)。我正在寻找最适合全屏的内容-文本和对象将根据屏幕分辨率改变大小。有什么建议吗?
答案 0 :(得分:2)
您可以使用python Tkinter模块。 Python附带的整个IDLE编辑器都是用Tkinter编码的!这是GUI的基本框架:
import tkinter as tk
class OOP:
def __init__(self):
self.win = tk.Tk()
self.win.title("My Title")
height = self.win.winfo_screenheight()
width = self.win.winfo_screenwidth()
self.win.geometry("%dx%d+0+0" % (width, height))
self.win.resizable(False, False)
self.create_widgets()
def click_me(self):
print("The button was pressed")
def create_widgets(self):
tk.Label(self.win, text="My GUI").pack(expand=1, fill='both')
tk.Button(self.win, text="Click ME", command=self.click_me).pack(expand=1, fill='both')
app = OOP()
app.win.mainloop()
在我看来,要使GUI随用户拖动而调整大小,似乎没有那么多代码。如果愿意,还可以指定初始化时使用的几何图形!