wxpython using variable with wx.statictext ignores \n
Simon Cropper
simoncropper at fossworkflowguides.com
Fri Jun 1 02:24:45 EDT 2012
Hi,
I have some wxPython code created with wxGlade that I am customizing.
I have a label created under the def __init__() section of the Frame
Class. It states...
self.Question = wx.StaticText(self, -1, "My question...")
if I insert a new line character in this string like this then the
output is placed on two lines as expected.
self.Question = wx.StaticText(self, -1, "My \nquestion...")
Output My
question
I am getting the question as an argument using sys.argv[] and putting
it in a variable called "question_text". The code is as follows...
question_text = "My \nquestion..."
self.Question = wx.StaticText(self, -1, question_text)
Output My \nquestion
How do I get the line text \n recognized so the break is inserted using
the variable technique like what happened when I actually used a string?
...in bash you would do "$question_text". Is there comparable macro
substitution in python.
--
Cheers Simon
Simon Cropper - Open Content Creator / Website Administrator
Free and Open Source Software Workflow Guides
------------------------------------------------------------
Introduction http://www.fossworkflowguides.com
GIS Packages http://www.fossworkflowguides.com/gis
bash / Python http://www.fossworkflowguides.com/scripting
More information about the Python-list
mailing list