GUI全屏基于文本的应用

问题描述 投票:-3回答:1

我对蟒蛇/ C#(开放两种语言)使一个基于文本的程序,它必须有一个GUI。程序始终以全屏显示。我试过的wxPython(太复杂,花费5小时制作1页,每一个对象是5-10行代码)和WinForms(不是最优的全屏幕)。我在寻找的东西,这将是最适合全屏 - 文本和对象将根据屏幕分辨率,分机改变它们的大小。有什么建议么?

c# python winforms user-interface fullscreen
1个回答
2
投票

您可以使用Python的Tkinter模块。整个IDLE编辑器附带的Python在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。您还可以指定它,如果你选择初始化几何!

© www.soinside.com 2019 - 2024. All rights reserved.