Nikolas Arend wrote:
Robin Dunn wrote:
Nikolas Arend wrote:
Hi again,
can I center the text in a wx.lib.dialogs.ScrolledMessageDialog()? I tried style=wx.TE_CENTRE, but that doesn't have any effect, the text is always left aligned.
Or which predefined dialog would be best suited for a simple 'About' dialog?
It depends on how simple is "simple" A lot of apps just use a wx.MessageDialog.
Fairly simple ;-), just text actually. But it should be scrollable also and I wouldn't like to have icons in the dialog. So, to come back to my first question, would it be possible to center the text in a wx.lib.dialogs.ScrolledMessageDialog()?
Not as it is now, but it's a very simple dialog (other than using the wacky Layoutf for the layout) so you can easily use it as a starting point to do whatever you want:
class ScrolledMessageDialog(wx.Dialog):
def __init__(self, parent, msg, caption,
pos=wx.DefaultPosition, size=(500,300),
style=wx.DEFAULT_DIALOG_STYLE):
wx.Dialog.__init__(self, parent, -1, caption, pos, size, style)
x, y = pos
if x == -1 and y == -1:
self.CenterOnScreen(wx.BOTH)
text = wx.TextCtrl(self, -1, msg,
style=wx.TE_MULTILINE | wx.TE_READONLY)
ok = wx.Button(self, wx.ID_OK, "OK")
ok.SetDefault()
lc = layoutf.Layoutf('t=t5#1;b=t5#2;l=l5#1;r=r5#1', (self,ok))
text.SetConstraints(lc)
lc = layoutf.Layoutf('b=b5#1;x%w50#1;w!80;h*', (self,))
ok.SetConstraints(lc)
self.SetAutoLayout(1)
self.Layout()
···
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!