是否可以使用tk创建text editor可以支持的内容syntax highlighting,autocomplete甚至可以在以后扩展IDE为特定语言?
我找到了tkinterwidget,但不确定它是否可以支持?
我认为如果一个小部件可以在用户编写文本时对文本进行一些处理,那么它可以用于此目的.
我想知道用于渲染无法用数学方程式(如汽车)表示的复杂曲面的技术OpenGL.我们是通过组合这么多基本元素(球体,锥形......)来创建的吗?还是有一些其他的方法?我即将开始创建一个应用程序来渲染3D汽车,并想知道从哪里开始.
我想tkinter text widget用作readonly小部件.它应该作为一个transcript领域.我的想法是将这个脚本保留在一个file用户写入任何内容的时候,只需删除小部件的所有内容,然后重新重写.
代码如下所示:
transcript_entry = SimpleEditor() # SimpleEditor is inherited from ScrolledText
transcript_entry.text.delete("1.0", END)
# this is just a test string, it should be the contents of the transcript file
transcript_entry.text.insert("1.0", "This is test transcript")
transcript_entry.text.bind("<KeyPress>", transcript_entry.readonly)
Run Code Online (Sandbox Code Playgroud)
而readonly功能将类似于:
def readonly(self, event):
self.text.delete("1.0", END)
# this is just a test string, it should be the contents of the transcript file
self.text.insert("1.0", "This is test transcript")
Run Code Online (Sandbox Code Playgroud)
这里的错误是用户输入的最后一个字符被添加到记录中.我怀疑原因是调用了readonly函数,then用户输入被写入窗口小部件.如何反转这个顺序并让readonly函数被调用after用户输入被写入窗口小部件? …