how to pass tkinter text to flex

六月ゝ 毕业季﹏ 提交于 2019-12-25 04:55:07

问题


I have a working c-bison-flex based project. I've started to build a python-tkinter environment for it, but I was fallen into a trap. I intended to copy the content of the tkinter's edit window to the buffer of 'c' application. There is no problem with text passing, I can reach the 'c' functions - but the buffer address is not known. The buffer is allocated by flex 'on the fly'. Any idea to workaround it? (Perhaps indifferent, but the system is Ubuntu.)


回答1:


flex provides an interface for switching between different input buffers, including the possibility of specifying an in-memory input buffer with the functions yy_scan_string and yy_scan_bytes (See the Flex manual for details.)

As the manual says, these routines make a copy of the string, so you still don't know the address of the string in flex. But it does mean that you don't need to keep the string around after you've created the flex buffer, which is convenient when you're interfacing with scripting systems.



来源:https://stackoverflow.com/questions/20168245/how-to-pass-tkinter-text-to-flex

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!