查看: 2174|回复: 0

[Python] python GUI库 —— PySimpleGUI 简洁的GUI库 Python GUIs for Humans

[复制链接]

142

主题

187

帖子

2170

积分

管理员

Rank: 10Rank: 10Rank: 10

积分
2170

活跃会员最佳新人

QQ
发表于 2023-3-20 20:58:18 | 显示全部楼层 |阅读模式
PySimpleGUI
Python GUIs for Humans


安装库 Install
[PowerShell] 纯文本查看 复制代码
pip install pysimplegui

示例代码 This Code
[Python] 纯文本查看 复制代码
import PySimpleGUI as sgsg.theme('DarkAmber')
# Add a touch of color
# All the stuff inside your window.
layout = [  [sg.Text('Some text on Row 1')],
            [sg.Text('Enter something on Row 2'), sg.InputText()],
            [sg.Button('Ok'), sg.Button('Cancel')] ]
# Create the Window
window = sg.Window('Window Title', layout)
# Event Loop to process "events" and get the "values" of the inputswhile True:
    event, values = window.read()
    if event == sg.WIN_CLOSED or event == 'Cancel': 
# if user closes window or clicks cancel
        break
    print('You entered ', values[0])

示例窗口 Makes This Window
68713283-7cb38200-056b-11ea-990a-aa1603af5a11.png






上一篇:python数据类型(不可变数据类型和可变数据类型)
下一篇:Python编程:从入门到实践【超清版】pdf
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表