sending commands in gui

Hello,

I am a beginner at gui building. Right now I have several python files which have the appropriate code all under 1 directory in which I am importing and sending commands in spyder. A typical one looks like this

si.sendCmd(78)
How do I bind that to a button? How do I import my gui once its finished?

I also have a command that looks like
si.sendCmd([70,20]) which i would like to adjust the second number (20). Is there a way to include an edit box in the gui for that command?

My vision for this gui is to be able to import via spyder and then use the gui instead of manually typing in the command lines.

I think this is fairly simple to figure out but I havnt been able to. hopefully someone has some insight for me!

Much thanks

I am a beginner at gui building. Right now I have several python files
which have the appropriate code all under 1 directory in which I am
importing and sending commands in spyder. A typical one looks like this

This would really be a question about how Spyder works, so good for a
Spyder list. I know I have no idea what si.sendCmd() does, or how.

But a note: Spyder is written with the QT toolkit (PyQT or PySide). As a
rule, having different toolkit sin one process does not play well. Spyder
may well run your code in a separate process, and even have a multi-process
sendCmd(), but if not, then you'll be better of doing this with QT than wx.

si.sendCmd(78)

How do I bind that to a button? How do I import my gui once its finished?

do you want si.sendCMD to be called when a user clicks a button? If so,
then it would be something like:

theButton = wx.Button(self, label="click_me")
theButton.Bind(wx.EVT_BUTTON, self.onButton)

def onButton(elf, evt)
    si.sendCmd(78)

where "self" is a wx.Window subclass, probably a wx.Panel.

What I'd do is write a little GUI stand-alone, without the Spyder stuff
first, to get some experience with how this works. See the various
tutorials online.

But again, the wx and QT event loops may get all tangled up..

I also have a command that looks like

si.sendCmd([70,20]) which i would like to adjust the second number (20).
Is there a way to include an edit box in the gui for that command?

yup -- you'd have a class that stored those values, and an edit bock or
slider, or whatever would let the user set them, and then you'd access the
class attributes when you call sendCmd()

Again -- I'd get a bit of this working without Spyder first...

-Chris

ยทยทยท

On Fri, Feb 14, 2014 at 11:33 AM, Jordan Kusiek <jordankusiek@gmail.com>wrote:

--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov