|
模块代码如下:- from tkinter import *
- class Gui(object):
- def __init__(self):
- pass
- def Create(self, Size, Title, BGColor, Position=[0, 0]):
- if len(Size) != 2:
- raise Exception("变量错误: 传入的Size异常")
- if type(Title) != str:
- raise Exception("变量错误: 传入的Title异常")
- if type(BGColor) != str:
- raise Exception("变量错误: 传入的BGColor异常")
- self.Gui = Tk()
- self.Gui.title(Title)
- self.Gui.geometry("{0}x{1}+{2}+{3}".format(Size[0], Size[1], Position[0], Position[1]))
- self.Gui.config(bg=BGColor)
- def GetGui(self):
- return self.Gui
- if __name__ == '__main__':
- Gui().Create([100, 100], "Test", "#0c0c0c")
复制代码 尝试了很多次都没用
|
|