Creating a graphical interface on top of SSH. How?

Alessandro Bottoni alessandro.bottoni at infinito.it
Wed Aug 17 03:48:55 EDT 2005


John F. wrote:

> I want to write a client app in Python using wxWindows that connects to
> my FreeBSD server via SSH (using my machine account credentials) and
> runs a python or shell script when requested (by clicking a button for
> instance).
> 
> Can someone give me some advice on how to create a "graphical shell"
> per se?

Well, a "graphical shell" is just a wxWidgets application that exposes a few
widgets (buttons, list, whatever). Each widget has a "event" associated to
it and this event can trigger whatever command, even a remote command on
your FreeBSD server (via ssh). As a consequence:
- create your user interface (I suggest you to use wxPython and wxGlade for
this)
- associate to each and every widget a "event handler"
- make your event handlers call your scripts on your FreeBSD machine via SSH
(use PySSH or Conch for this)

Python has a couple of good implementation of SSH:
http://pyssh.sourceforge.net/
http://twistedmatrix.com/projects/conch/
Both of them are well documented.

You can find a small example here:
http://www.palovick.com/code/python/python-ssh-client.php

Do not use wxWidgets directly. You would have to re-create a lot of
Python-wxWidgets integration that already exists. Use wxPython instead
(www.wxpython.org). There is a quite good GUI builder for wxPython that is
called wxGlade. It can generate XML files that are easier to maintain than
C o Python code.

CU
-----------------------------------
Alessandro Bottoni



More information about the Python-list mailing list