What's the best/neatest way to get Unicode data from a database into a grid cell?

cl at isbd.net cl at isbd.net
Mon Feb 8 05:42:11 EST 2016


Vlastimil Brom <vlastimil.brom at gmail.com> wrote:
> 
> Hi,
> your code in
> http://www.salstat.com/news/linking-wxgrid-to-sqlite-database-in-python-an-example
> 
> seems to work for me after small changes with both python 2.7 and 3.4
> (using wx Phoenix)

Where are you getting phoenix from?  It's not in the Ubuntu
repositories and when I search on Google I seem to go in ever
decreasing circles and always end up finding wxPython for 2.7.

Did you build it from source yourself (I can do that but only if it's
necessary).


> the changes I made are:
> - encoding declaration at the beginning of the file (mainly for py 2,
> if utf-8 is used):
> 
> #! Python
> # -*- coding: utf-8 -*-
> 
> - removing the str(...) call in the offending line you mentioned:
>  self.SetCellValue(row_num, i, cells[i])
> (what was the intent of the conversion to str?)
> 
I've no idea what the intent is/was, I just copied the code as I found
it.  I guess the cell value could be numeric.


> - corrected event name (insted of EVT_GRID_CELL_CHANGE)
> self.Bind(gridlib.EVT_GRID_CELL_CHANGED, self.CellContentsChanged)
> 
> - normal App() call (instead of the PySimpleApp)
> 
> app = wx.App()
> 
> I randomly tried some characters using Latin, Greek etc. characters
> (within BMP) as well as Gothic - beyond the FFFF range - the cell
> content seems to be saved and and newly loaded from the sqlite db on
> subsequent calls of the app.
> 
Thanks for your help, very useful.

-- 
Chris Green
·



More information about the Python-list mailing list