On Wed, Jan 12, 2011 at 9:29 PM, David Hutto <smokefl...@gmail.com> wrote: > On Sun, Jan 9, 2011 at 9:03 AM, ALAN GAULD <alan.ga...@btinternet.com> wrote: >> >> >>> The following line is what I mean by calling a command line from within the >>>app >>> using subprocess. >>> >>> self.espeak = subprocess.Popen(['espeak', word],stdout = >>> subprocess.PIPE).communicate()[0] >>
I came up with this as an example, I am still learning also :) [code] #!/usr/bin/python # wx python + espeak from subprocess import call import sys import wx class ESpeak(wx.Dialog): def __init__(self, parent, id, title): wx.Dialog.__init__(self, parent, id, title, size=(360, 370)) panel = wx.Panel(self, -1) vbox = wx.BoxSizer(wx.VERTICAL) hbox1 = wx.BoxSizer(wx.HORIZONTAL) st1 = wx.StaticText(panel, -1, 'Enter Saying: ') self.tc1 = wx.TextCtrl(panel, -1, size=(180, -1)) button_send = wx.Button(panel, 1, 'Say') hbox1.Add(st1, 0, wx.LEFT, 10) hbox1.Add(self.tc1, 0, wx.LEFT, 10) vbox.Add(hbox1, 0, wx.TOP, 50) vbox.Add(button_send, 0, wx.ALIGN_CENTER | wx.TOP | wx.TOP | wx.BOTTOM, 100) self.Bind(wx.EVT_BUTTON, self.OnSpeak, id=1) panel.SetSizer(vbox) self.Centre() self.ShowModal() self.Destroy() def OnSpeak(self, event): say = self.tc1.GetValue() if say != "": espeak = "/usr/bin/espeak" call([espeak, say]) else: dlg = wx.MessageDialog(self, 'What did you say?', 'Error', wx.OK | wx.ICON_ERROR) dlg.ShowModal() dlg.Destroy() app = wx.App() ESpeak(None, -1, 'wxESpeak') app.MainLoop() [/code] -david _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor