Python编程:tkinter创建GUI可视化界面

简介: Python编程:tkinter创建GUI可视化界面

简单的测试一下tkinter

import tkinter as tk
from tkinter import ttk 
from tkinter import messagebox
root = tk.Tk()  # 生成主窗口
root.title("窗体测试程序")   # 窗体名称
root.geometry("400x300")   # 指定窗体大小
label = ttk.Label(root, text="hello world")
label.pack()
# 事件
def click(event):
    messagebox.showinfo("hello world", "this is a some info")
button1 = tk.Button(root, text="tk-button")
button1.bind("<Button-1>", click)
button1.pack(side=tk.LEFT)
button2 = ttk.Button(root, text="ttk-button")
button2.bind("<Button-1>", click)
button2.pack(side=tk.RIGHT)
root.mainloop()  # 消息循环

界面效果:

1.png

参考:

tkinter模块常用参数(python3)

https://www.cnblogs.com/aland-1415/p/6849193.html


Tkinter简易教程

https://www.cnblogs.com/tkinter/p/5629578.html


pyhon之Tkinter实例化学习

https://www.cnblogs.com/kaituorensheng/p/3287652.html


Python基础总结(七)(Tkinter的GUI的程序设计)

https://www.jianshu.com/p/5c7a1af4aa53


An Introduction to Tkinter (Work in Progress)

http://effbot.org/tkinterbook/

相关文章
|
3月前
|
开发框架 开发者 Python
探索Python GUI编程:从Tkinter到PyQt的全方位使用
在当今技术发展日新月异的时代,Python作为一种简洁高效的编程语言,拥有广泛的应用领域。其中,GUI(图形用户界面)编程是Python开发者经常涉足的领域之一。本文将介绍两个常用的Python GUI库——Tkinter和PyQt,并深入探讨其使用方法、特点以及适用场景,帮助读者全面了解Python GUI编程的魅力。
|
3月前
|
存储 Python
Python实战项目(十三)使用 Tkinter GUI 库构建闹钟应用程序
Python实战项目(十三)使用 Tkinter GUI 库构建闹钟应用程序
39 0
|
3月前
|
数据可视化 Linux C++
Python GUI编程:Tkinter与PyQt的选择
Python作为一门流行的编程语言,在GUI编程领域也有着非常强大的工具。其中,Tkinter和PyQt是两个备受推崇的GUI库。本文将介绍这两个库的优缺点,并帮助读者决定应该选择哪一个。
63 0
|
3天前
|
Python
python tkinter 最简洁的计算器按钮排列
python tkinter 最简洁的计算器按钮排列
8 0
|
3月前
|
Python
python tkinter Tcl_AsyncDelete: async handler deleted by the wrong thread
python tkinter Tcl_AsyncDelete: async handler deleted by the wrong thread
39 1
|
25天前
|
Python
python使用tkinter库,封装操作excel为GUI程序
python使用tkinter库,封装操作excel为GUI程序
|
1月前
|
安全 UED Python
Python中使用Tkinter和Difflib模块实现文本比对功能
Python中使用Tkinter和Difflib模块实现文本比对功能
20 0
|
2月前
|
数据可视化 API 开发者
Python中的图形界面开发:Tkinter、PyQt或wxPython入门
Python中的图形界面开发:Tkinter、PyQt或wxPython入门
|
2月前
|
定位技术 Python
用Python Tkinter打造的精彩连连看小游戏【附源码】
用Python Tkinter打造的精彩连连看小游戏【附源码】
34 0
|
2月前
|
Python
python 用tkinter实现电子时钟
python 用tkinter实现电子时钟
30 1