Here is another nifty tidbit of python code that is often hard to find. If you work with Python and wxPython to build gui apps, there are a number of widgets etc., that can be hard to figure out. Adding a task bar icon for your app is one of them. This simple example shows you how to add a taskbar icon, and capture events from it.
Trolltech has finally launched a GPL version of their software for Win32. This is great news for myself, and a lot of people out there.I for one, have never been able to install QT properly on my linux box.
There was always some missing or mis-referenced library, and I never could get it to work. I could also never seem to find the old 2.3 Win32 version that was GPL’d. Now, I can try it on my windoze box, and see if it is easier to write my Python Gui’s.
I have found that there is not a lot of documentation out there that shows you a simple way to instantiate a socket connection. Here is a simple code snippet, that shows you how to make a connection using the socket module. This would be useful for checking whether a host is listening on a particular port. This is not a full sockets implementation(no send, or recieve), but simply tests if a TCP socket is open.
I thought I would throw some information out there that has helped me immensely in the past. Here is a link to some articles on Devshed.com that simplify and de-mystify some common problems people have when learning Python, from beginner on up. For beginners I suggest checking out the articles here and here for info on file handling and sockets.
Also, check out the forums if you are ever in need of some guidance or help in the world of Python , or just about any other language/technology.
Though there are a lot of resources out there for Python,and great books, rarely do you find a simple reference guide that helps you navigate the basics. I found that there was not a lot of reference material to help you do the simple things, if you didn’t know what to look for.
This little guide will focus on the basics of reading and writing files in python..