|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 天圆突破 于 2018-11-14 10:19 编辑
我创建了tkinter窗口后,就调整了窗口的大小,位置等信息,但是为什么还会有一闪而现的初始默认root窗口(大概不到0.5秒的时间,闪一下就没了)?有什么办法能不让显示那个一闪而过的小窗口吗?
- class Main:
- def __init__(self):
- # 主事件
- self.root = Tk()
- use_theme()
- session = session_obj()
- title, version = session.query(Version.title, Version.version).all()[0]
- session.close()
- self.root.title('%s %s' % (title, version))
- self.root.iconbitmap(os.path.join(images_path, 'logo.ico'))
- images_dict = dict()
- images_dict['login_background'] = PhotoImage(file=os.path.join(images_path, 'login.png'))
- images_dict['search_text'] = PhotoImage(file=os.path.join(images_path, 'baidu.png'))
- # 开始事件循环
- Login(self.root, images_dict)
- self.root.mainloop()
- class Login:
- def __init__(self, master, images_dict):
- # 主事件
- self.root = master
- self.images_dict = images_dict
- # 定义界面大小及位置
- width = 500 # 窗口宽度
- heigh = 300 # 窗口高度
- windows_width = self.root.winfo_screenwidth() # 屏幕宽度
- windows_heigh = self.root.winfo_screenheight() # 屏幕高度
- root_x = (windows_width - width) // 2 # 窗口x坐标
- root_y = (windows_heigh - heigh) // 2 # 窗口y坐标
- self.root.geometry('%dx%d+%d+%d' % (width, heigh, root_x, root_y)) # 配置大小及位置
- self.root.resizable(0, 0) # 不允许调整窗口大小
- self.root.overrideredirect(True) # 隐藏标题栏
- self.root.attributes('-topmost', True) # 置顶窗口(窗口在最顶层)
- # 定义变量,用户名和密码
- self.var_user = StringVar()
- self.var_password = StringVar()
- self.var_check_user = IntVar()
- self.var_check_password = IntVar()
- # 载入用户信息
- self.load_user_info()
- # 生成登陆界面
- self.create_login_page()
复制代码
上面代码无法运行,因为有些东西是读数据库的,那部分代码没贴上来
然后还有一个问题,想一起请教了
ttk.TreeView这个部件,一旦创建好字段(columns)属性以后,还有办法在不destory()掉的情况下更改吗?有没有初始化columns的方法? |
|