views:

76

answers:

3

i had made a program for text to speech convertion in python..and now want to make an gui for it...

i have installed wxpython..and have been trying few example available online to understand,but i am not exactly understanding it..

i basically want a frame and a text box to enter text and a button...on clicking the button it the text in the text should be copied to the file and run the app.py file for giving the result.. I am finding this difficult as i am new to wxwidgets.. looking for some help..can someone tell how to perform this simple task in wxpython???

can i do it in vb and connect my py code to it??

import wx
app=wx.App(redirect=False)
window=wx.Frame(None, title='sample gui app',pos=(100,100),size=(400,500))
hellobtn=wx.Button(window,label='hello',pos = (200, 200), size = (60,25))
byeBtn=wx.Button(window,label='bye',pos=(250,250),size=(60,25))
printArea=wx.TextCtrl(window,pos=(10,10),size=(400-120-15-10,25),style=wx.TE_MULTILINE)

window.Show()
app.MainLoop()

this is the code i wrote for creating a frames and text box and button hjow to add events to this and connect to the my code..on clicking a button i want it to run my .py file from cmd prmt on anywhere..

Thanks in advance..

A: 

If you want to create the GUI in vb, take a look at IronPython: it's a Python implementation on .net, so you can use the entire .net ecosystem with your Python code.

Ned Batchelder
+1  A: 

Since Ned Batchelder covered the VB part of your question, I'll outline a wxPython approach.

In short you'll need to import your module that contains the code you've written previously, then bind the button's click event to a function that calls your code.

import myText2Speech
... code above ...

hellobtn.Bind(wx.EVT_BUTTON, self.OnButton)

def OnButton(self, event):
    """Prep whatever's needed, and call function txt2speech module."""

Of course your final code should be cleaner than all this, but this should give you a jumping off point.

acrosman
i didnt write my code of text to speech in function and neither to i have a main for it..so can i still use this method..can u please be a bit more specific on how to write the code please!
kaki
Sounds like you'll need to clean up your original code a bit so that it can be called from other places easily. That would apply no matter the GUI you try to build. If nothing else you could move much of your old code into OnButton().
acrosman
A: 

I would like to add that as far a Python GUI programming goes, my best experience has been with Python and QT. I can only assume that the Windows experience is as good as the Linux one.

gomad