Posts

Showing posts with the label Python

Using wx.stc.StyledTextCtrl

I started to use wxpython a couple of weeks ago. Actually I tried it for a while before but decided to use PyGtk that time for my Copymanager. Anyway, yesterday I needed to use a text control with style support; in wx the widget for that is StyledTextCtrl . When I added it to my window I noticed the horizontal scrollbar appeared by default, even if the content of the widget didn't fill the view. Thinking this control should behave somehow similar to TextCtrl I tried using wx.TE_MULTILINE but this had no effect on the StyledTextCtrl. After reading its entire documentation and trying a couple of options I found WrapMode property that finally gave me what I wanted. styledTextCtrl = wx.stc.StyledTextCtrl(parent) styledTextCtrl.WrapMode = True

Two links

I got this from a couple of tweets of my friend Maykel Moya ( http://twitter.com/maykelmoya ): ack is a tool like grep, aimed at programmers with large trees of heterogeneous source code. ack is written purely in Perl, and takes advantage of the power of Perl's regular expressions. http://betterthangrep.com/ Are two different references to the same integer value the same object? The answer: sometimes. Python gotcha: Bizarre integer equality

¡Python me hace volar!

Image
Bien acertada esta tira de comic. Espero la disfruten tanto como lo hice yo Tomado de xkcd.com

Aplicación con ícono en el área de notificación usando pygtk

Hace unos días escribí en la lista de pygtk un ejemplo de como crear una aplicación que muestre un ícono en el área de notificación y que permita mostrar y ocultar una ventana cuando se haga clic sobre dicho ícono. Me pareció algo sencillo de hacer pero que le puede servir de guía a más de una persona. Esta es la idea que usamos en el CopyManager así que si quieren ver otro ejemplo más usado de esto pueden remitirse a nuestro svn . import pygtk pygtk.require('2.0') import gtk class Application(object): def __init__(self): # Creamos el icono que se mostrará en el área de notificación self.statusicon = gtk.status_icon_new_from_stock('gtk-about') # Y lo ponemos en dicha área self.statusicon.set_visible(True) # Creamos la ventana self.window = gtk.Window() self.window.show_all() # Conectamos las señales que vamos a usar self.statusicon.connect('activate', self.on_activate) self.window.connect...