| | |
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 |
alarm app beginner cipher cmd cx-freeze data decimals development dictionary directory dynamic error examples feet file float format function generator getvalue gui halp homework http images import input ip itunes java keycontrol leftmouse line linux list lists logging loop maintain maze millimeter module mouse mysqldb number numbers output parsing path port prime programming projects push py2exe pygame pyglet pymailer pyqt python queue random recursion schedule screensaverloopinactive script scrolledtext slicenotation split sqlite ssh string strings sudokusolver table terminal text thread threading time tlapse tuple tutorial ubuntu unicode url urllib urllib2 variable variables ventrilo verify vigenere web webservice wikipedia wx.wizard wxpython xlwt





