0

I made a GUI using python. Now in the GUI i created a button which when clicked should launch an application(in my case it's MEDINA Pre-processor). i've used subprocess module in the callback function of the button but the application was not getting launched.

I'm using python2.7 and linux CENT OS.

How can i do this? the code is as follows:

#!/usr/bin/python
import Tkinter as tk

import subprocess

class StageGui:
    def __init__(self,parent):
        self.f = tk.Frame(main, width=300, height=300)
        self.b1=tk.Button(main,text='Start Medina',command=startmedina).pack(side='left',anchor='nw')
        self.b2=tk.Button(main,text='Quit Medina',command=quitmedina).pack(side='left',anchor='nw')
        self.xf = tk.Frame(self.f,relief='groove', borderwidth=2)

def startmedina():
    subprocess.call(['prexx'],shell=True)

    return
def quitmedina():
    return  
main = tk.Tk()
stagegui=StageGui(main)
main.title('prototype')

main.mainloop()
ayaan
  • 635
  • 4
  • 15
  • 34
  • Can you show us the code about launching application? – Stephen Lin Aug 01 '14 at 09:27
  • yeah i'll add in the question – ayaan Aug 01 '14 at 09:29
  • i've added the code in the ques @m170897017 – ayaan Aug 01 '14 at 09:36
  • I copypasted your code, replaced command in subprocess call from ['prexx'] to ['ls'], and it works. Please check if you can run `prexx` manually, or from python shell with subprocess. Maybe something wrong with application, because python code works. – pavel_form Aug 01 '14 at 11:32
  • @ayaan Try like pavel_form said and put subprocess.call in a try-except block to see if there is exception. – Stephen Lin Aug 02 '14 at 00:55
  • @pavel_form 'prexx' in the code is an alias for the medina preprocesor. i've changed it with the full path to medina executable file, then i get the following error:error while loading shared libraries: libregex.so: cannot open shared object file: No such file or directory what does it mean?? – ayaan Aug 04 '14 at 03:16
  • This is a system problem with your installation of medina. Please check this http://stackoverflow.com/questions/480764/linux-error-while-loading-shared-libraries-cannot-open-shared-object-file-no-s and this http://itsfoss.com/solve-open-shared-object-file-quick-tip/ – pavel_form Aug 04 '14 at 11:38
  • i solved the issue it lies with prexx and the alias given was pre_xx, so thankx for u'r help @pavel_form – ayaan Aug 04 '14 at 16:55

0 Answers0