12、弹窗 messagebox

import tkinter as tk
from tkinter import messagebox
root = tk.Tk()
root.title("xxx")
root.geometry('200x100') def hit_me():
# tk.messagebox.showinfo(title='Hi', message='hahaha') # message 给窗口的信息,图标是python火箭
# tk.messagebox.showwarning(title='Hi', message='程序有错, 是否修改下执行') # 提示信息框 ,图标是感叹号
# tk.messagebox.showerror(title='Hi', message='程序错了不能再运行了')
# tk.messagebox.askquestion(title='Hi', message='yes or no') # 问用户信息,有返回值,返回值是yes和no
# if return == 'yes':
# print('xxxx')
# tk.messagebox.askyesno(title='Hi', message='yes or no') # 返回的是 False 和 True
print(tk.messagebox.askretrycancel(title='Hi', message='yes or no')) # 返回的是 重试True 和取消False
print(tk.messagebox.askokcancel(title='Hi', message='yes or no')) # 第一次返回的是 重试True 和取消False
# 第二次返回的是 确定True 和取消False
tk.Button(root, text='hit me', command=hit_me).pack() root.mainloop()

13、放置位置   pack grid place

import tkinter as tk
root = tk.Tk()
root.title("xxx")
root.geometry('200x100')
# pack方法
# tk.Label(root, text=1).pack(side='top') # 上
# tk.Label(root, text=1).pack(side='bottom') # 下
# tk.Label(root, text=1).pack(side='left') # 左
# tk.Label(root, text=1).pack(side='right') # 右 # grid方法12格子方法, 4行, 3列
# for i in range(4):
# for j in range(3):
# # row 行 column 列 padx 长 pady 高
# tk.Label(root, text=1).grid(row=i, column=j, padx=10, pady=10) # palce 精准放置
tk.Label(root, text=1).place(x=10, y=100, anchor='nw') # anchor 放在哪个角部 root.mainloop()

最新文章

  1. Thinkpad X240在Centos 7下使用ID 138a:0017或者vfs5011指纹识别
  2. Java元组Tuple使用实例--转载
  3. eval(phpcode) 字符当代码执行
  4. linux 网络栈中的queueing
  5. Spring中的创建与销毁
  6. C#传递参数大集合
  7. Linux下Apache服务器并发优化
  8. 阿里云ECS-Nginx阿里云客户端IP日志记录
  9. Ubuntu基本命令--apt, dpkg
  10. Zkdash安装
  11. JVM性能监控与故障处理命令汇总(jps、jstat、jinfo、jmap、jhat、jstack)
  12. docker run -v参数
  13. txt文本处理---行未添加逗号
  14. 30秒了解Excel的前世今生
  15. PHP实现IP访问限制及提交次数的方法详解
  16. mac下安装rzsz
  17. AtCoder Grand Contest 006
  18. Java编程的逻辑 (7) - 如何从乱码中恢复 (下)?
  19. js 获取元素所有兄弟节点实例
  20. 怎么查看CI,codeigniter的版本信息?想看某个项目中使用的CI具体是哪个版本,怎么查看?

热门文章

  1. 1.typescirpt学习之路,*.d.ts和@types关系理解
  2. rust-vmm 学习
  3. lower_bound( )和upper_bound( )怎么用嘞↓↓↓
  4. python创建缩略图和选择轮廓效果
  5. Python绘制3D图形
  6. 对异步处理的http接口进行性能测试
  7. [转]eclipse中 properties文件编码问题
  8. (转)python3:类方法,静态方法和实例方法以及应用场景
  9. CentOS离线状态下安装Python3.7.0
  10. Python - Django - form 组件基本用法