如何在Django中使用wxSpellCheckerDialog? [英] How to use wxSpellCheckerDialog in Django?

查看:53
本文介绍了如何在Django中使用wxSpellCheckerDialog?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据pyenchant 文档的用法如下,

According to pyenchant documentation usage is follows,

>> 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()

这将打开拼写校正对话框.

This opens spell correction dialogbox.

那我该如何找回修改过的文本?

So how can i get modified text back ?

text = chkr.get_text()返回更正的文本.但是我遇到了以下错误.

text = chkr.get_text() returns corrected text. But I'm getting following error.

PyAssertionErrorC ++断言"wxThread :: IsMain()"在wxEventLoop :: Dispatch()中的.... \ src \ msw \ evtloop.cpp(244)处失败:只有主线程才能处理Windows消息

PyAssertionError at /quiz/submit/ C++ assertion "wxThread::IsMain()" failed at ....\src\msw\evtloop.cpp(244) in wxEventLoop::Dispatch(): only the main thread can process Windows messages

这是我实现的代码

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()

推荐答案

我很确定您调用了 chkr.getText()返回正确的文本.

I am pretty sure you call chkr.getText() which returns the corrected text.

这篇关于如何在Django中使用wxSpellCheckerDialog?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆