zoukankan      html  css  js  c++  java
  • Python GUI tkinter窗口视窗学习4

    Python GUI tkinter窗口视窗学习4

    # test13
    import tkinter as tk
    window = tk.Tk()
    window.title('my test')
    window.geometry('700x400')
    # 在windows窗口上创建一个frame
    frame = tk.Frame(window)
    frame.pack()
    # 创建第二层框架frame,在主框架frame上
    frame_l = tk.Frame(frame)
    frame_r = tk.Frame(frame)
    frame_l.pack(side = 'left')
    frame_r.pack(side = 'right')
    # 创建三组标签,为第二层frame上面的内容,分为左区域和右区域,用不同颜色标识
    tk.Label(frame_l,text = 'on the frame_l1',bg = 'green').pack()
    tk.Label(frame_l,text = 'on the frame_l1',bg = 'green').pack()
    tk.Label(frame_l,text = 'on the frame_l1',bg = 'green').pack()
    tk.Label(frame_r,text = 'on the frame_r1',bg = 'red').pack()
    
    window.mainloop()
    

    # test14
    import tkinter as tk
    # 使用messagebox需要先导入模块
    import tkinter.messagebox
    window = tk.Tk()
    window.title('my test')
    window.geometry('700x400')
    def hit_me():
    	tkinter.messagebox.showinfo(title='Hi', message='你好!')
    	   #  tkinter.messagebox.showinfo(title='Hi', message='你好!')            # 提示信息对话窗
        # tkinter.messagebox.showwarning(title='Hi', message='有警告!')       # 提出警告对话窗
        # tkinter.messagebox.showerror(title='Hi', message='出错了!')         # 提出错误对话窗
        # print(tkinter.messagebox.askquestion(title='Hi', message='你好!'))  # 询问选择对话窗return 'yes', 'no'
        # print(tkinter.messagebox.askyesno(title='Hi', message='你好!'))     # return 'True', 'False'
        # print(tkinter.messagebox.askokcancel(title='Hi', message='你好!'))  # return 'True', 'False'
    tk.Button(window,text = 'hit me',bg = 'green',command = hit_me).pack()
    window.mainloop()
    
    
    

  • 相关阅读:
    asp.net core 2.0的认证和授权
    数据库性能优化详解
    StringUtils.defaultIfBlank
    SQL优化(二) 快速计算Distinct Count
    SQL语句中Left join,right join,inner join用法
    sql中的limit关键字
    多线程之间的资源共享
    面试长谈的String,StringBuffer,StringBuilder三兄弟有啥区别
    关于java中的值传递与引用传递遇到的问题
    Struts1和Struts2的区别和对比:
  • 原文地址:https://www.cnblogs.com/serendipity-my/p/13720608.html
Copyright © 2011-2022 走看看