如何从pyside中的滑块获取值? [英] How to get values from the slider in pyside?

查看:46
本文介绍了如何从pyside中的滑块获取值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我是 gui 和 qt 的新手,有点卡住了.我从这里下载了滑块示例 a> [qt.gitorious.org] 并将其调整为仅滑块.我现在得到的代码如下:http://pastebin.com/EkXxdPee

I’m a total newbi in general gui and qt, and am kind of stuck. I downloaded the slider example from here [qt.gitorious.org] and sobered it down to just the sliders. The code I’ve got right now is as follows: http://pastebin.com/EkXxdPee

我现在想从滑块中读取值并对其进行处理(使用 zeromq 将其发送到另一个程序).我想我必须对 valueChanged 做一些事情,但我不知道是什么.有人可以帮我一点吗?

I now want to read the values from the slider and do stuff with it (send it over to another program using zeromq). I guess I have to do something with valueChanged, but I have no clue what. Could anybody help me out a little bit?

欢迎所有提示!

感谢 Romha Korev 的回答和一些谷歌搜索,我在这里找到了一个完整的工作示例:http://zetcode.com/gui/pysidetutorial/widgets/

Thanks to the answer of Romha Korev and some googling I found a full working example here: http://zetcode.com/gui/pysidetutorial/widgets/

我只是从那里开始工作,现在我终于拥有了我想要的东西.谢谢!

I simply worked from there and I finally have what I want now. Thanks!

推荐答案

使用 value() 方法获取 QSlider 中的值.

Use the method value() to get the value in the QSlider.

slider = QtGui.QSlider()
slider.setValue( 5 )
print( slider.value() ) # Will print '5'

这篇关于如何从pyside中的滑块获取值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆