~vijaykumar

[ Home | Feed | Twitter | Vector Art | Ascii Art | Tutorials ]

Chennaipy November Meet Minutes

Thu, 29 Nov 2012

Python user’s in Chennai, met again on 24th November. We had about 13 people participating in the meet this time. We discussed about regular expressions, GUI programming with GTK, and a web application development project.

Regular Expressions

After self introduction of the members, we started off with regular expressions talk by Arunram. Arunram used re module and the findall() method to demonstrate regular expressions. He first explained the matching meta-characters . and []. He then explained the repetition meta-character +, *, and {m,n}. He also demonstrated grouping operators, that can extract a group of characters in a match. One of the interesting examples, he worked out was, to find words in a text that had a letter occurring twice consecutively. He wanted to find words like

hitting
boom
occurring

We finally came up with the following regex, which involved back referencing.

(\w*(.)\2\w*)

This initially didn’t work, and Arun Kirushna pointed out that we need to use r"…" string variant. This triggered a discussion on raw strings and why we need them.

PyGTK

We then moved on to the PyGTK talk. Vijay developed a simple hello world program in the Python interactive prompt.

>>> import gtk
>>> win = gtk.Window()
>>> button = gtk.Button("Press Me!")
>>> win.add(button)
>>> win.show_all()
>>> gtk.main()

He then showed how to attach a callback to the click event on the button. He then showed how the same could be achieved, using Glade.

He then explained how to build more complex UIs, and discussed why absolute placement approach taken by Visual Basic, was bad. He took an example of paint brush program, where the toolbar needs to be fixed and the drawing area had to be scaled as the window is re-sized. He showed how this could be achieved through packing using HBox and VBox, in GTK.

Programming Task

Rengaraj, had offered to take up the development of the web based quiz application. He described the approach he would be taking and some preliminary code that he had developed. Hopefully, in the next meet we will be demonstrating the application and walking through the code.

With this we came to the end of another wonderful Python meet.

Permalink | Add Comment | Share: Twitter, Facebook, Buzz, ... | Tags: chennaipy, python

blog comments powered by Disqus

Powered by Python | Made with PyBlosxom | Valid XHTML 1.1 | Best Viewed With Any Browser | Icon Credits | CC-BY-SA