File: wx_example.py

package info (click to toggle)
pyenchant 1.6.7-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 420 kB
  • ctags: 571
  • sloc: python: 3,210; makefile: 42; sh: 5
file content (30 lines) | stat: -rw-r--r-- 743 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30


import wx

from enchant.checker import SpellChecker
from enchant.checker.wxSpellCheckerDialog import wxSpellCheckerDialog

# Retrieve the text to be checked
text = "this is some smple text with a few erors in it"
print "[INITIAL TEXT:]", text

# Need to have an App before any windows will be shown
app = wx.App(False)

# Construct the dialog, and the SpellChecker it is to use
dlg = wxSpellCheckerDialog(None)
chkr = SpellChecker("en_US",text)
dlg.SetSpellChecker(chkr)

# Display the dialog, allowing user interaction
if dlg.ShowModal() == wx.ID_OK:
    # Checking completed successfully
    # Retrieve the modified text
    print "[FINAL TEXT:]", chkr.get_text()
else:
    # Checking was cancelled
    print "[CHECKING CANCELLED]"