basic questions to TextCtrl and icons in message dialogs

Hi

I'm new to GUI programming and just making my first steps in wxPython. As every newbie I'm running against walls, but the wxPython Demo are really, really helpful.

However, as for now some questions remain:
Is it possible to tell a TextCtrl widget: 'Please color all digits you receive (using AppendText() for instance) in red.'? How? And even more basic: What is the syntax to change the font setting for a TextCtrl field? I've tried and tried but cannot do it. What I finally what to achieve is something like: Set flag 1 and send string, it gets displayed in style 1, set flag 2 results in display style 2, and so on ...

The second part concerns icons in a wx.MessageDialog: What is necessary to display icons? If a message dialog is raised like this: mss = wx.MessageDialog(self,"bla bla","ERROR",wx.OK) - what must I do to display an standard error icon, for instance?

I understand that parts of this must be very simple to some of you, but I would already very much appreciate if you could point me at least on the right document (which I probably just overlooked).

Thank you very much in advance,
Christian

Christian Meesters wrote:

Hi

I'm new to GUI programming and just making my first steps in wxPython. As every newbie I'm running against walls, but the wxPython Demo are really, really helpful.

However, as for now some questions remain:
Is it possible to tell a TextCtrl widget: 'Please color all digits you receive (using AppendText() for instance) in red.'? How? And even more basic: What is the syntax to change the font setting for a TextCtrl field? I've tried and tried but cannot do it. What I finally what to achieve is something like: Set flag 1 and send string, it gets displayed in style 1, set flag 2 results in display style 2, and so on ...

Look at the wxTextCtrl Styles in the wxTextCtrl section of the documentation.

The second part concerns icons in a wx.MessageDialog: What is necessary to display icons? If a message dialog is raised like this: mss = wx.MessageDialog(self,"bla bla","ERROR",wx.OK) - what must I do to display an standard error icon, for instance?

Add one of the wx.ICON_* styles to your wx.OK style.

mss = wx.MessageDialog(self,"bla bla","ERROR", wx.OK | wx.ICON_ERROR)

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Christian Meesters <cmeesters@ucdavis.edu> writes:

Hi

I'm new to GUI programming and just making my first steps in wxPython.
As every newbie I'm running against walls, but the wxPython Demo are
really, really helpful.

However, as for now some questions remain:
Is it possible to tell a TextCtrl widget: 'Please color all digits you
receive (using AppendText() for instance) in red.'? How? And even more

http://wxwidgets.org/manuals/2.4.2/wx381.htm#wxtextctrlsetstyle

basic: What is the syntax to change the font setting for a TextCtrl
field? I've tried and tried but cannot do it. What I finally what to

What have you tried doing?

achieve is something like: Set flag 1 and send string, it gets
displayed in style 1, set flag 2 results in display style 2, and so on
...

Take a look at
http://wxwidgets.org/manuals/2.4.2/wx381.htm#wxtextctrlwritetext and
http://wxwidgets.org/manuals/2.4.2/wx381.htm#wxtextctrlappendtext as
well. They might help to apply the changes to the new chars after the
flag was set.

The second part concerns icons in a wx.MessageDialog: What is necessary
to display icons? If a message dialog is raised like this: mss =
wx.MessageDialog(self,"bla bla","ERROR",wx.OK) - what must I do to
display an standard error icon, for instance?

http://wxwidgets.org/manuals/2.4.2/wx266.htm#wxmessagedialogconstr

See the 'style' option.

I understand that parts of this must be very simple to some of you, but
I would already very much appreciate if you could point me at least on
the right document (which I probably just overlooked).

Be seeing you,

···

--
Godoy. <godoy@ieee.org>