开发者

How do you position a wx.MessageDialog (wxPython)?

Is there any reason why the position, pos, flag doesn't seem to work in the following example?

dlg = wx.MessageDialog(
    parent=self,
    message='You must enter a URL',
    caption='Error',
    style=wx.OK | wx.ICON_ERROR | wx.STAY_ON_TOP,
    pos=(200,200)
)

dlg.ShowModal()
dlg.Destroy()

The documentation is here: http://www.wxpython.org/docs/api/wx.MessageDialog-class.html

'self' is a reference to the frame. I'm running in Wind开发者_StackOverflow中文版ows Vista, python26, wxpython28. The message dialog always appears to be in the middle of the screen.

If for some reason it's not possible to position the dialog, is there anyway to at least restrict the dialog to be in the frame, rather than just the center of the screen?


It seems to be a bug and i think you should file the same. for time being you can user your own dervied dialog class to center it as you wish. Also instead of wx.MessageDialog you can use wx.MessageBox, it will save you few lines.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜