Python GUI implementation direction

Viewed 91

I am currently writing a wxPython GUI with Twisted Python integrated to be able to send basic text over LAN to a RaspberryPi. I am at a point where I want some help figuring out the design path that would be best for this project when it comes to the way I should implement my networking.

To briefly give more context to the project I have been tasked to create a GUI that connects to a RaspberryPi which controls a research grade CCD, (basically an Astronomy use only camera) a very expensive piece of equipment. I will be sending commands, given by the user over, the local network to a TwistedPython server that uses a "parser" to send the commands to the CCD drivers.

On to figuring out the network design philosophy. I am at the point where the major components of my GUI are implemented and just start needing to talk over the network. As for the network coding, I have successfully implemented in a few buttons the code needed to send text over the network (e.g. when I hit the camera expose button it sends the file name and time of exposure). It is at this point where I need to decide on whether I should be using threading or not. I have some experience in threading through C programming with openMP, MPI, and Pthreads, but I can't wrap my head around what "kind" of threading I should be using.

Some research has lead me to see that there is the Python built in threading and then threading with TwistedPython. I fail to see the big differences in the two when it comes to how they work. Overall, I think I want it so I can just simply open up a separate thread for Twisted and then send a line of text off and then close it when I am done. However, I am not sure which way of threading I should implement this. There is also the possibility that I don't even need to implement threading if I am only sending small bits of data over the area network.

There is one part in my GUI that I know will need threading and that would be a progress bar that updates via a clock. The GUI should still be usable while this is going on, because in Astronomy you can have exposures lasting over ten minutes.

Anyway can some of you folks help me pose the right questions for my needs?

Thanks

1 Answers

It looks like this is an really "old" question without any answer. I hope you have figured it out by now, if not I have a solution you might be interested. I have done something similarly, except I was using an Arduino with an EthernetShield.

I use socket to communicate through LAN and python built-in thread (threading.Thread) to do whatever task it needs to be done.

Now the question is that are you having your GUI inside your Twisted framework? If so, then you should simply rely on the Twisted framework to make your code more maintainable. If not, since your GUI is already built, you can use the method I mentioned above to communicate to the server. If my understanding is wrong, you should clear with me on the architecture/relationship of the GUI, Twisted, and server.

Related