0
據pyenchant documentation用法如下, 如何在Django中使用wxSpellCheckerDialog?
>> import wx
>> from enchant.checker import SpellChecker
>> from enchant.checker.wxSpellCheckerDialog import wxSpellCheckerDialog
>>
>> app = wx.PySimpleApp()
>> text = "This is sme text with a fw speling errors in it. Here are a fw more to tst it ut."
>> dlg = wxSpellCheckerDialog(None,-1,"")
>> chkr = SpellChecker("en_US",text)
>> dlg.SetSpellChecker(chkr)
>> dlg.Show()
>> app.MainLoop()
這將打開拼寫校正對話框。
那麼我怎樣才能得到修改後的文本?
EDIT 1:
文本=糾正的文本chkr.get_text()返回。但我得到以下錯誤。
PyAssertionError在/測驗/提交/ C++斷言 「wxThread :: IsMain()」 在失敗.... \ SRC \ MSW \在wxEventLoop ::調度()evtloop.cpp(244):只有主線程可以處理Windows消息
這是我實現
app = wx.PySimpleApp()
text = "This is sme text with a fw speling errors in it. Here are a fw more to tst it ut."
dlg = wxSpellCheckerDialog(None,-1,"")
chkr = SpellChecker("en_US",text)
dlg.SetSpellChecker(chkr)
dlg.ShowModal()
text = chkr.get_text()
謝謝:)它在第一次更正。通過刷新頁面提供follwing錯誤再次運行它。在wxEventLoop :: Dispatch()中,.. \ .. \ src \ msw \ evtloop.cpp(244)中的C++ assertion「wxThread :: IsMain()」失敗:只有主線程可以處理Windows消息 – ChamingaD
您正在使用我在Django應用程序中看到的GUI拼寫檢查程序(在第一次發佈時沒有看到該標記)?這將是你的問題。 – Drakekin
它與第一次檢查和下次崩潰 – ChamingaD