Hi,

I am new to wxpython and trying to develop a small GUI interface (shown below). User selects a python script from "Browse run script" and when he/she hits the button "Execute RunScript", the script should execute via aardvark i2c interface. But I am not sure why it's not getting executed. I cannot even see any error messages after hitting the button.

Any help is really appreciated!!

import wx
import wx.grid
import wx.html
import wx.aui
from aardvark_py import *
from time import *
import cStringIO
import os
import subprocess

    self.runScript = wx.TextCtrl(self.panel,-1, "", wx.Point(100, 352), wx.Size(350, 20),
                           wx.NO_BORDER)

    self.rsButton = wx.Button(self.panel, 4, 'Browse Run Script', (475,350))
    self.Bind(wx.EVT_BUTTON, self.OnSelectRS, self.rsButton)

    self.exeButton = wx.Button(self.panel, 5, 'Execute RunScript', (250,400))
    self.Bind(wx.EVT_BUTTON, self.OnexeRS, self.exeButton)

    def OnSelectRS(self, event):
        with wx.FileDialog(self, "Choose a file to open", "",
                           "", "*.*", wx.OPEN) as dlg:
            if dlg.ShowModal() == wx.ID_OK:
                path = dlg.GetPath()
                print("RunScript location: ", path)
                self.runScript.SetValue(path)

    def OnexeRS(self, event):
        scriptPath = self.runScript.GetValue()
        subprocess.call(scriptPath, shell=True) 

Thanks Gribouillis! I was able to at least see the error code now. It kind of worked.. Thanks for you help!!!

This question has already been answered. Start a new discussion instead.