conn = psycopg2.connect(conn_string) # user, password and such
cur = conn.cursor()
cur.execute(query)
rows = cur.fetchall() # We have the rows returned from the db
if rows: # for every parameter used
msg = "Please wait while we process your request..."
busyDlg = wx.BusyInfo(msg)
for r in rows:
# here you would insert it in the rictextctrl
Hope this helps
···
El martes, 29 de agosto de 2017, 4:54:09 (UTC+2), dennis spera escribió:
the following loads contents of richtextctrl (text) into db, when I query db it looks correct.
I’m using 2.7 so as you said my code my not work for 4.x.
Have you tried to extract the tags from the xml and using setFont and the like to use the attributes again?
You could easily use a regular expresion to search for fontpointsize=9 and use SetFontSize(9), textcolor"#000000" → SetForegroundText(000000).
I have not used an XMLControl but this is how I would do it for a wx.RichTextControl.
···
El martes, 29 de agosto de 2017, 19:05:42 (UTC+2), dennis spera escribió:
I am using wxpython 4.x, I think the code you posted will only
work for 3.x from what I have read or are you using 4.x as well ?
On Tue, Aug 29, 2017 at 12:55 PM, David Woods tran...@gmail.com wrote:
I use the RichTextXMLHandler that's included in the wx.richtext
module:
try:
We need to setup a StringIO object to emulate a file
stream = cStringIO.StringIO(text)
Create an XML Handler
handler = wx.richtext.RichTextXMLHandler()
Load the XML text via the XML Handler.
Note that for XML, the BUFFER is passed.
handler.LoadStream(self.GetBuffer(), stream)
exception handling
except:
print “XML Handler Load failed”
print
print sys.exc_info()[0], sys.exc_info()[1]
print traceback.print_exc()
I've also written RTF and DOCx parsers for the RichTextCtrl which
Just to let you know that wxPython 4 (Sphinx) works just fine under
python 2.7 for me at least - just pip install wxpython does the trick.
There are some areas where there were things that you could get away
with in 3 now cause asserts but in the vast majority of cases once they
are resolved for wxpython 4 they still work or work better under 3.
Of course it is well worth transitioning to wxPython 4 as it also works
with python 3 and 2020 is looming.
···
On 08/09/2017 07:38, Marcos del Amo wrote:
I'm using 2.7 so as you said my code my not work for 4.x.
Have you tried to extract the tags from the xml and using setFont and
the like to use the attributes again?
--
Steve (Gadget) Barnes
Any opinions in this message are my personal opinions and do not reflect
those of my employer.
---
This email has been checked for viruses by AVG.
I’m using 2.7 so as you said my code my not work for 4.x.
Have you tried to extract the tags from the xml and using setFont and the like to use the attributes again?
You could easily use a regular expresion to search for fontpointsize=9 and use SetFontSize(9), textcolor"#000000" → SetForegroundText(000000).
I have not used an XMLControl but this is how I would do it for a wx.RichTextControl.
El martes, 29 de agosto de 2017, 19:05:42 (UTC+2), dennis spera escribió:
I am using wxpython 4.x, I think the code you posted will only
work for 3.x from what I have read or are you using 4.x as well ?
On Tue, Aug 29, 2017 at 12:55 PM, David Woods tran...@gmail.com wrote:
I use the RichTextXMLHandler that's included in the wx.richtext
module:
try:
We need to setup a StringIO object to emulate a file
stream = cStringIO.StringIO(text)
Create an XML Handler
handler = wx.richtext.RichTextXMLHandler()
Load the XML text via the XML Handler.
Note that for XML, the BUFFER is passed.
handler.LoadStream(self.GetBuffer(), stream)
exception handling
except:
print “XML Handler Load failed”
print
print sys.exc_info()[0], sys.exc_info()[1]
print traceback.print_exc()
I've also written RTF and DOCx parsers for the RichTextCtrl which