Hi Guys , this questioned has been asked before , but the answers haven helped me .
I want to seperate lines when i am appending the text control. But "\n" is simply not working .
I am using Python 2.7 , on Windows 7. Please help. I want to display all file names
on next line , whenever user adds a file . Thanks in advance.
Also note , if we create a text ,
>>> hello = "This is a rather long string containing\n\
several lines of text just as you would do in C.\n\
Note that whitespace at the beginning of the line is\
'This is a rather long string containing\nseveral lines of text just as you would do in C.\n Note that whitespace at the beginning of the line is significant.'
So you can see even this is not working with basic string .
wx.Frame.__init__(self, None, -1, 'Text Entry Example', size=(500, 450))
panel = wx.Panel(self, -1)
doosra=wx.Menu() #So there will be two drop down menu
#Menu Bar Items
menu_1=menubar.Append(pehla,"File") #Naming of Menu items
item1_1=pehla.Append(wx.ID_OPEN,"Add","This is add files") #Sub-Items of First menu pull down list
item1_2=pehla.Append(wx.ID_EXIT,"Exit","This will exit app") #The last comment will show on status bar when mouse is on that option
#multiLabel = wx.StaticText(panel, -1, "Multi-line")
Search_Text = wx.TextCtrl(panel, -1,"Enter search string",pos=(5,5),size=(350,30), style=wx.ALIGN_LEFT)
self.Files_List = wx.TextCtrl(panel, -1,mytext,size=wx.Size(400,100),pos=(5,40),style=wx.TE_READONLY)
btn_Process = wx.Button(panel,-1,label='Search',pos=(360,5))
self.Bind(wx.EVT_BUTTON, self.Process, btn_Process)
def OnFileOpen(self, e):
""" File|Open event - Open dialog box. """
self.dirname = ''
dlg = wx.FileDialog(self, "Choose a file", self.dirname, "", "*.xls*")
if (dlg.ShowModal() == wx.ID_OK):
self.fileName = dlg.GetFilename()
self.dirName = dlg.GetDirectory()
def OnFileExit(self, e):
""" File|Exit event """
print"This is a test"
app = wx.PySimpleApp()
frame = TextFrame()
On the REPL, when you type a name which exists (can be a variable, class name, function etc.), the output shown is the str() representation of that name. For e.g. ... If you want to view the output of the interpolated string (after taking into consideration the escape sequences etc.), use the print construct. ...
On the REPL, when you type a name which exists (can be a variable, class name, function etc.), the output shown is the str() representation of that name. For e.g.
>>> s = "Hello\nWorld"
If you want to view the output of the interpolated string (after taking into consideration the escape sequences etc.), use the print construct.
>>> s = "Hello\nWorld"
>>> print s
U r right...It did work when 'Print' is used. But what about places where we cannot use 'Print' . I have to use it in self.Files_List.AppendText(text1+"\n") . Well , i finally used os.linesep() which works well. But its a shame i had to import os just for this purpose . Anyways , thanks , u certainly cleared one concept i did'nt knew.