Is there a way to incorporate a spell checker within a wxPython gui? I would like to be able to check the spelling of wx.TextCtrl values before they get posted to a sqlite3 database.

I would imagine that the spell checker would be very os specific, but for me it would be really important that it worked on Linux, Ubuntu (9.4 and 9.10) and that it works on various flavors of Windows.

I most certainly wouldn't want to build a spell checker, only if I can connect to a spell checker already on my machine.

Just to show some code, below are a couple sections, of which there are a number in this gui. First, the initialization of the class:

class BirdUpload(wx.Frame, EachBird):
    """Bird Upload extends my EachBird class (bird.py module)
    
    The class provides a gui framework for working with bird list uploading.
    """
    def __init__(self, parent, id, title='Blu - Bird List Uploader', dbase='', table='', presetCountry='', presetYear=''):
        wx.Frame.__init__(self, parent, id, title, size=(700, 720))
        EachBird.__init__(self, dbase, table)

And some of the fields boxsizers containing the textctrls:

# Country_
        hbox10 = wx.BoxSizer(wx.HORIZONTAL)
        self.country = wx.StaticText(self.panel, -1, "Country", size=(180, 30))
        self.country.SetFont(self.font)
        hbox10.Add(self.country, 0, wx.RIGHT | wx.TOP, 8)
        if self.prStCntry == '':
            self.country_input = wx.TextCtrl(self.panel, -1, size=(400, 30))
        else:
            self.country_input = wx.TextCtrl(self.panel, -1, value=self.prStCntry, size=(400, 30))            
        hbox10.Add(self.country_input, 1)        
        vbox.Add(hbox10, 0, wx.LEFT | wx.TOP, 10)        
        
        # Notes_
        hbox11 = wx.BoxSizer(wx.HORIZONTAL)
        self.Notes = wx.StaticText(self.panel, -1, "Notes", size=(180, 30))
        self.Notes.SetFont(self.font)
        hbox11.Add(self.Notes, 0, wx.RIGHT | wx.TOP, 8)
        self.notes_input = wx.TextCtrl(self.panel, -1, size=(400, 120), style=wx.TE_MULTILINE)
        hbox11.Add(self.notes_input, 1)        
        vbox.Add(hbox11, 0, wx.LEFT | wx.TOP, 10)

I'm not sure, but Pidgin, the popular chat client uses Aspell.
So maybe try that:
http://aspell.net/
You can make your own spell-checker
refer to this:
http://norvig.com/spell-correct.html
All you need is a text file with a list of correctly spelled words. That you can find at aspell somewhere.

Thanks jcao219,

I was assuming that there would be some easier way, but I guess not. I'll have to see if I can get stuck into getting something like that working.

It might be a lot simpler to use the Python module enchant, see:
http://www.rfk.id.au/software/pyenchant/

I had actually found it while searching around, and I have been trying to install it (which is turning out tricker than is should be for linux, it certainly doesn't work with a simple get-apt)

If I get it all working nicely, I'll post an example.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.