| | |
wxWidgets - RichTextCtrl - Is ther one?
Thread Solved |
•
•
Join Date: Nov 2008
Posts: 3
Reputation:
Solved Threads: 1
OK. I've tried saving and loading XML files produced by the RichTextCtrl demo on Linux, and everything worked without a hitch.
I'm running Linux Mint 5.0 (derived from Ubuntu 8.04), wxPython 2.8.9.1.
If you have an older version of wxPython, maybe that's why it doesn't work.
Please make sure that when loading the document back you select the correct filter (not txt, but xml).
I'm running Linux Mint 5.0 (derived from Ubuntu 8.04), wxPython 2.8.9.1.
If you have an older version of wxPython, maybe that's why it doesn't work.
Please make sure that when loading the document back you select the correct filter (not txt, but xml).
•
•
Join Date: Nov 2008
Posts: 41
Reputation:
Solved Threads: 1
Hmm, I'm using wxPython 2.8.9.1 and Ubuntu 7.10 but I can see a possible problem here:
When it comes to loading, there is no choice of filters, only "*" - this might well be the cause of the problem.
Iv had a look at the code for the demo, but I cant see how to change the filter on the load event. Ill have to try and work that out before I go any further because if this works my problem is solved - I don't care what format the text is saved in, just so long as it can be saved and loaded and look like RTF style text to the user.
Many thanks for your efforts, and if you have any tips about how to get that load filter set up on the demo Id be more than happy to try it out!
Regards
Max
When it comes to loading, there is no choice of filters, only "*" - this might well be the cause of the problem.
Iv had a look at the code for the demo, but I cant see how to change the filter on the load event. Ill have to try and work that out before I go any further because if this works my problem is solved - I don't care what format the text is saved in, just so long as it can be saved and loaded and look like RTF style text to the user.
Many thanks for your efforts, and if you have any tips about how to get that load filter set up on the demo Id be more than happy to try it out!

Regards
Max
•
•
Join Date: Nov 2008
Posts: 41
Reputation:
Solved Threads: 1
Okay, the problem has been sorted out now:
The demo saves nicely in XML (.xml or .ox) but when it comes to loading the code is not correct and the filter only shows *.*
To correct this, in the OnFileOpen routine, the following change must be made:
Having made this change the control will save as XML and load from XML and display as Rich Text! The problem is now fixed, so many thanks to everyone who tried to help out, but especially to alvinru for pointing in the right direction!
Regards
Max
The demo saves nicely in XML (.xml or .ox) but when it comes to loading the code is not correct and the filter only shows *.*
To correct this, in the OnFileOpen routine, the following change must be made:
python Syntax (Toggle Plain Text)
def OnFileOpen(self, evt): wildcard, types = rt.RichTextBuffer.GetExtWildcard(save=False) dlg = wx.FileDialog(self, "Choose a filename", #The following line was changed from "*.*" wildcard=wildcard, style=wx.OPEN) if dlg.ShowModal() == wx.ID_OK: path = dlg.GetPath() if path: fileType = types[dlg.GetFilterIndex()] self.rtc.LoadFile(path, fileType) dlg.Destroy()
Having made this change the control will save as XML and load from XML and display as Rich Text! The problem is now fixed, so many thanks to everyone who tried to help out, but especially to alvinru for pointing in the right direction!
Regards
Max
![]() |
Other Threads in the Python Forum
- Previous Thread: python+apache+gnome-open
- Next Thread: Jython question
| Thread Tools | Search this Thread |
accessdenied advanced aliased application argv beginner bits calling casino change command convert count csv cturtle cursor def dictionary digital dynamic dynamically edit enter event external file float format frange function google homework i/o iframe import inches input jaunty java keyboard lapse line linux list lists loop microphone mouse movingimageswithpygame multiple newb number numbers numeric obexftp output parameters parsing path prime programming projects py py2exe pygame pyopengl python random recursion remote return reverse scrolledtext session signal simple skinning software sprite statictext string strings syntax text threading time tlapse trick tuple tutorial ubuntu unicode unit urllib urllib2 variable voip web-scrape whileloop wxpython





