开发者

Glade 3 Standard Button Layout

I want to create a dialog using Glade 3 (or gtk and Python). In Glade 2 if you wanted to create a dialog box there was an option to set a "standard button layout" which would automatically create an Ok button and a Cancel button which return either gtk.RESPONSE_OK or gtk.REPONSE_CANCEL. This feature has not been reimplmented in Glade 3.

How can I create a 开发者_如何学Godialog which will have ok and cancel buttons which return the correct response?

Cheers,

Pete


You can create them manually in Glade; the response code can unfortunately only be set to a number. The numbers you need are here: OK is -5, Cancel is -6.

Or you can create it in code:

dialog = gtk.MessageDialog(flags=gtk.DIALOG_MODAL, 
    buttons=gtk.BUTTONS_OK_CANCEL, 
    message_format='Are you sure you want to reticulate the splines?')
response = dialog.run()
dialog.destroy()
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜