V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
Matrix24
V2EX  ›  Python

Pyside 如何将界面元素和具体的操作和反应函数连接起来?

  •  
  •   Matrix24 · 2014-02-13 02:34:42 +08:00 · 3001 次点击
    这是一个创建于 3726 天前的主题,其中的信息可能已经有所发展或是发生改变。
    新手,现在已经晕的七荤八素了。
    Pyside用户,通过Qt Designer生成了一个界面类,然后就不知道怎么办了?
    原谅我英语水平和慌乱的心情。
    可否请懂得大神们,耐心的教教我这个节点
    2 条回复    1970-01-01 08:00:00 +08:00
    billowen
        1
    billowen  
       2014-02-13 11:26:15 +08:00 via iPhone   ❤️ 1
    通过connect连接到响应函数。比如一个button btn,他会有一个clicked的slot,通过下面语法就可以连接到响应函数func:btn.clicked.connect(func)。
    我记得大致是这样,正好前段时间也浏览了一下pyside。
    kcworms
        2
    kcworms  
       2014-02-13 13:15:55 +08:00   ❤️ 1
    既然是用设计师生成的,那么可以让它来自动连接我们有着特殊命名的方法。可以查看文档:PySide.QtCore.QMetaObject.connectSlotsByName。
    例子:http://jimmykuu.sinaapp.com/blog/11
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2751 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 11:59 · PVG 19:59 · LAX 04:59 · JFK 07:59
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.