How can I link a set of toggle buttons like radio buttons?(如何链接一组切换按钮,如单选按钮?)
问题描述
我正在使用 Python 3 和 Gtk 的 gobject 自省.我怎样才能将多个切换按钮链接在一起,以便它们的行为类似于选项卡或单选按钮 - 例如默认选择一个,当另一个被 clicked 时,之前的 active 一个被取消选择.
I am using Python 3 with gobject introspection for Gtk. How can I have more than one toggle button linked together so they behave similar to tabs or radiobuttons - e.g. one is selected by default, and when another is clicked the previously active one is de-selected.
我曾尝试使用 set_sensetive,但它应用的小部件会变灰.
I have tried using set_sensetive, but that greys out the widget that it is applied on.
推荐答案
使用 set_active()(或 props.active).或者,您可以创建一些 Gtk.RadioButton 小部件并将 draw_indicator 属性设置为 False.在后一种情况下,您可以以正常方式创建单选组,无需自定义处理.
Use set_active() (or props.active). Alternatively, you can create some Gtk.RadioButton widgets and set draw_indicator property to False. In the latter case you can create radio groups in normal way, without custom handling.
这篇关于如何链接一组切换按钮,如单选按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何链接一组切换按钮,如单选按钮?
				
        
 
            
        基础教程推荐
- 包装空间模型 2022-01-01
 - PANDA VALUE_COUNTS包含GROUP BY之前的所有值 2022-01-01
 - 求两个直方图的卷积 2022-01-01
 - 无法导入 Pytorch [WinError 126] 找不到指定的模块 2022-01-01
 - 在同一图形上绘制Bokeh的烛台和音量条 2022-01-01
 - Plotly:如何设置绘图图形的样式,使其不显示缺失日期的间隙? 2022-01-01
 - PermissionError: pip 从 8.1.1 升级到 8.1.2 2022-01-01
 - 使用大型矩阵时禁止 Pycharm 输出中的自动换行符 2022-01-01
 - 在Python中从Azure BLOB存储中读取文件 2022-01-01
 - 修改列表中的数据帧不起作用 2022-01-01
 
    	
    	
    	
    	
    	
    	
    	
    	
				
				
				
				