def create_list(self, options_list):
message_dialog = Gtk.MessageDialog(
None,
0,
Gtk.MessageType.QUESTION,
Gtk.ButtonsType.OK,
_("Choose version:")
)
message_dialog.set_default_size(360, 0)
content_area = message_dialog.get_content_area()
content_area.set_property('margin_top', 10)
content_area.set_property('margin_bottom', 10)
content_area.set_property('margin_left', 10)
content_area.set_property('margin_right', 10)
options_list = options_list.split(', ')
def cb_radiobutton(radiobutton):
self.option = radiobutton.get_label()
box = Gtk.Box(
orientation=Gtk.Orientation.VERTICAL,
spacing = 10
)
radiobutton1 = Gtk.RadioButton(
label = options_list[0]
)
radiobutton1.connect('clicked', cb_radiobutton)
box.pack_start(radiobutton1, True, True, 0)
for i in range(1, len(options_list)):
radiobutton = Gtk.RadioButton(
label = options_list[i]
)
radiobutton.connect('clicked', cb_radiobutton)
radiobutton.join_group(radiobutton1)
box.pack_start(radiobutton, True, True, 0)
content_area.pack_start(box, True, True, 0)
self.option = options_list[0]
message_dialog.show_all()
response = message_dialog.run()
message_dialog.destroy()
return self.option
评论列表
文章目录