Viewing Category : python

Post thumbnail of Python Easter Eggs
8 June 2011
Continue reading Python Easter Eggs

Python Easter Eggs

There are a few hidden easter eggs in python. So next time you fire up the python shell try to import hello and this. I wonder how many other hidden gems there are.

Post thumbnail of Use gtk settings to make buttons show their icons again
17 May 2011
Continue reading Use gtk settings to make buttons show their icons again

Use gtk settings to make buttons show their icons again

ou may have noticed gtk has stopped showing images for buttons by default. Many apps have not bothered to check the default settings and just assumed that defining an image for a button meant it would show. Too bad the gtk devs decided to change the default value. But never fear, for there is a way to make sure the image shows without modifying the system or user preferences outside of your application!

Post thumbnail of How to write simple netsnmp apps in Python
29 April 2011
Continue reading How to write simple netsnmp apps in Python

How to write simple netsnmp apps in Python

Here’s a couple of different ways you can use netsnmp in Python. I had a hard time finding documentation, and what I did find was old and outdated. I figured most of it out just by playing around with the library.

Post thumbnail of Print without a newline in Python
24 February 2011
Continue reading Print without a newline in Python

Print without a newline in Python

With python 3 you can override the print function’s delimiter value to make it null or whatever else you want. But if you’re stuck with 2.5 or 2.6 like the rest of us, try this on for size. The only problem with this is when you want to use it like a progress bar. If you do this in a loop over time, you will get the expected output, but over time it won’t be the way you expected.

Post thumbnail of Simple trick to figure out where your python libraries are stored
27 October 2010
Continue reading Simple trick to figure out where your python libraries are stored

Simple trick to figure out where your python libraries are stored

Here’s a simple trick to figure out where your python libraries are stored.

Post thumbnail of Force gui updates during long callbacks or internal operations in pygtk or gtk
28 May 2010
Continue reading Force gui updates during long callbacks or internal operations in pygtk or gtk

Force gui updates during long callbacks or internal operations in pygtk or gtk

This faq is the most useful pygtk resource you will find. The full documentation is great for looking up which methods to use or what’s available in one class or another, but it’s the little nooks and crannies that are always left out by most pygtk resource sites that I …

Post thumbnail of Python memory management
19 May 2010
Continue reading Python memory management

Python memory management

Object creation and deletion is handled for you, but have you ever thought about how it works, when is memory freed, etc.? Think of everything in python as an object. Even something as simple as this, and since’s its a string, you can invoke any string method. When you lose access to some object, that memory is freed on its own. If you assign a string to a variable, you will find the memory locations are the same. Calling __del__ only removes access to the object from the local or global namespace. It does not mean the memory location has been freed.

Post thumbnail of Convert wordpress xml export file into a python dictionary
3 May 2010
Continue reading Convert wordpress xml export file into a python dictionary

Convert wordpress xml export file into a python dictionary

Requires web2py which includes Common shortcuts, Widgets, py2jquery module, Database store configuration settings, Class based menu builder, syntax highlighting, Output compression, and more.

Post thumbnail of Connect pygtk data stores to gtk.treeviews
27 April 2010
Continue reading Connect pygtk data stores to gtk.treeviews

Connect pygtk data stores to gtk.treeviews

This is a pygtk treeview setup for attaching models to several similar views that will have the same look and feel such as font family, color, size, etc. Now in your constructor, you can attach the models like this: (i’m using gtkbuilder to create some of the basic stuff but I make my own data stores)

Post thumbnail of Generate python code from Glade XML files
22 April 2010
Continue reading Generate python code from Glade XML files

Generate python code from Glade XML files

Why can’t I find a code generator that works? Tepache is a code sketcher for python that uses pygtk and glade, but it is broken and it looks like it hasn’t been updated since July 2005 anyway. Gladex was broken out of the box. Autocode does not like my glade and the documentation is limited.

 Page 2 of 4 « 1  2  3  4 »
Powered by Wordpress   |   Lunated designed by ZenVerse