如何使用 Python 调用 TCL 过程

编程入门 行业动态 更新时间:2024-10-27 06:28:40
本文介绍了如何使用 Python 调用 TCL 过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

使用下面的代码,我可以调用 Proc.tcl 文件中的所有过程,但我想单独调用 sum 或 sub 等过程,请告诉我任何其他调用它的可能性

Using below code i can able to call all procedure in the Proc.tcl file ,but i want to call individually the procs like sum or sub ,Please let me know any other possibility to call it

我的 proc 文件程序,

My proc file program,

 puts "hello"
    proc sum {a b} {

     set c [expr $a + $b]
     puts "Addition: $c "
    }




  proc sub {a b} {

     set c [expr $a - $b]
     puts "Substraction: $c "
    }

我的主文件程序,

 import Tkinter
    import os
    r=Tkinter.Tk()
    r.tk.eval('source proc.tcl')

推荐答案

代替 r.tk.eval('source proc.tcl')

instead of r.tk.eval('source proc.tcl')

尝试使用 os.system ('source proc.tcl')并导入操作系统

try with os.system ('source proc.tcl') and import OS

这篇关于如何使用 Python 调用 TCL 过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-05-01 09:32:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1407288.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何使用   过程   Python   TCL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!