python的gui中赋值给command_在Tkinter GUI中写入终端

该博客介绍了如何在Python的Tkinter GUI中实现实时显示命令行输出,并尝试将按钮点击事件与命令行脚本执行绑定。作者通过创建不同按钮调用不同的shell脚本,但遇到问题无法正确绑定按钮的`command`属性。示例代码展示了如何创建GUI窗口、定义按钮回调函数以及嵌入终端。
摘要由CSDN通过智能技术生成

我试图在我的Tkinter GUI中实时显示命令行中的更改,我成功地创建了GUI并将终端集成到其中,但我无法将按钮与终端绑定,我的代码是:import Tkinter

from Tkinter import *

import subprocess

import os

from os import system as cmd

WINDOW_SIZE = "600x400"

top = Tkinter.Tk()

top.geometry(WINDOW_SIZE)

def helloCallBack():

print "Below is the output from the shell script in terminal"

subprocess.call('perl /projects/tfs/users/$USER/scripts_coverage.pl', shell=True)

def BasicCovTests():

print "Below is the output from the shell script in terminal"

subprocess.call('perl /projects/tfs/users/$USER/basic_coverage_tests.pl', shell=True)

def FullCovTests():

print "Below is the output from the shell script in terminal"

subprocess.call('perl /projects/tfs/users/$USER/basic_coverage_tests.pl',

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值