943,608 Members | Top Members by Rank

Ad:
  • Python Discussion Thread
  • Marked Solved
  • Views: 2920
  • Python RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Nov 9th, 2008
0

Re: wxWidgets - RichTextCtrl - Is ther one?

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).
Reputation Points: 10
Solved Threads: 1
Newbie Poster
alvinru is offline Offline
3 posts
since Nov 2008
Nov 9th, 2008
0

Re: wxWidgets - RichTextCtrl - Is ther one?

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
Reputation Points: 10
Solved Threads: 1
Light Poster
MaxVK is offline Offline
46 posts
since Nov 2008
Nov 9th, 2008
0

Re: wxWidgets - RichTextCtrl - Is ther one?

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:

python Syntax (Toggle Plain Text)
  1. def OnFileOpen(self, evt):
  2. wildcard, types = rt.RichTextBuffer.GetExtWildcard(save=False)
  3. dlg = wx.FileDialog(self, "Choose a filename",
  4. #The following line was changed from "*.*"
  5. wildcard=wildcard,
  6. style=wx.OPEN)
  7. if dlg.ShowModal() == wx.ID_OK:
  8. path = dlg.GetPath()
  9. if path:
  10. fileType = types[dlg.GetFilterIndex()]
  11. self.rtc.LoadFile(path, fileType)
  12. 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
Reputation Points: 10
Solved Threads: 1
Light Poster
MaxVK is offline Offline
46 posts
since Nov 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Python Forum Timeline: python+apache+gnome-open
Next Thread in Python Forum Timeline: Jython question





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC