我使用 gtk2x,python 2.7.3,我需要根据在 gtkEntry 文本框中输入的值创建一个列表。有什么“简单”的方法可以解决这个问题吗?
全局变量定义:
groupID = []
gtkEntry 框的定义:
<object class="GtkEntry" id="gtkENTRY1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="text" translatable="yes">-</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
<property name="primary_icon_sensitive">True</property>
<property name="secondary_icon_sensitive">True</property>
</object>
获取对象:
self.gID = builder.get_object("gtkENTRY1")
从对象中获取文本:
groupID = self.gID.get_text()
输入的值:
value1,value2
需要的输出:
list = [value1,value2]
实际输出:
list = [v,a,l,u,e,1,v,a,l,u,e,2]