Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #106206 > unrolled thread

Help is needed!

Started by"A. ElKader" <muhkader@gmail.com>
First post2016-04-01 10:34 +0300
Last post2016-04-01 10:34 +0300
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  Help is needed! "A. ElKader" <muhkader@gmail.com> - 2016-04-01 10:34 +0300

#106206 — Help is needed!

From"A. ElKader" <muhkader@gmail.com>
Date2016-04-01 10:34 +0300
SubjectHelp is needed!
Message-ID<mailman.301.1459496178.28225.python-list@python.org>
Hi,

I am trying to do the following :

I am trying to show the changes in the command line in real time in my
Tkinter GUI, I managed to create the GUI and integrate the terminal into
it, but I cant bind the buttons with the terminal, my code is :

import Tkinterfrom Tkinter import *import subprocessimport osfrom 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', shell=True)

Scripts_coverage  = Tkinter.Button(top, text ="Scripts Coverage",
command = helloCallBack)Scripts_coverage.pack()
Basic_coverage_tests  = Tkinter.Button(top, text ="Basic Coverage
Tests", command = BasicCovTests)Basic_coverage_tests.pack()
Full_coverage_tests  = Tkinter.Button(top, text ="Full Coverage
Tests", command = FullCovTests)Full_coverage_tests.pack()

termf = Frame(top, height=100, width=500)

termf.pack(fill=BOTH, expand=YES)
wid = termf.winfo_id()

os.system('xterm -into %d -geometry 100x20 -sb &' % wid)
def send_entry_to_terminal(*args):
    """*args needed since callback may be called from no arg (button)
   or one arg (entry)
   """
    cmd("%s" % (BasicCovTests))

top.mainloop()
I want win I click the button to see it printing the command in the
terminal[image: enter image description here]
<http://i.stack.imgur.com/6pSN8.png>


How do I do that ???

Please advice

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web