IronPython 2.0 Alpha 4 Released Permalink

IronPython 2.0 Alpha 4 Released!! While it might not be quite as notable at Python 3000 it is a steady step forward.

Posted by Davy Mitchell on 2007-09-07 22:50:25.
Categories: IronPython, Python Tags :  
Like this post? Digg it or Del.icio.us it. |



Make Twitter Talk With IronPython Permalink

I have been having fun with my unusual commutes this week thanks to Twitter so I decided to revisit one of my talking Python scripts. Check the Twitter API page for a list of XML's - the sample script reads the public timeline.

import clr
clr.AddReference('System.Speech')
clr.AddReference('System.Xml')

from System.Speech.Synthesis import SpeechSynthesizer
from System.Net import WebClient
from System.Xml import XmlDocument, XmlTextReader


content = WebClient().DownloadString("http://twitter.com/statuses/public_timeline.xml")
xmlDoc = XmlDocument()
spk = SpeechSynthesizer()

xmlDoc.LoadXml(content)
statusesNode = xmlDoc.SelectSingleNode("statuses")
for status in statusesNode:
    s = "<?xml version=\"1.0\"?><speak version=\"1.0\" xml:lang=\"en-US\"><break/>"
    s = s + status.SelectSingleNode("text").InnerText + "</speak>"
    spk.SpeakSsml(s)

Posted by Davy Mitchell on 2007-09-07 22:31:23.
Categories: IronPython, Python Tags :  
Like this post? Digg it or Del.icio.us it. |



Minimise A WinForm To The System Tray Permalink

You will need a test.ico in the same directory to run this code.


import clr

clr.AddReference("System.Windows.Forms")
clr.AddReference("System.Drawing")

from System.Drawing import Icon
from System.Windows.Forms import (Application, Form, NotifyIcon, FormWindowState, MouseButtons)

class Main(Form):

    def __init__(self):
        self.initNotifyIcon()
        self.Resize += self.ResizeForm

    def initNotifyIcon(self):
        self.notifyIcon = NotifyIcon()
        self.notifyIcon.Icon = Icon("test.ico")
        self.notifyIcon.Visible = False
        self.notifyIcon.MouseDoubleClick += self.DoubleClickOnTrayIcon

    def ResizeForm(self, s, e):
        if self.WindowState == FormWindowState.Minimized:
            self.notifyIcon.Visible = True
            self.Visible = False

    def DoubleClickOnTrayIcon(self, s, e):
        if e.Button == MouseButtons.Left:
            self.Visible = True
            if self.WindowState == FormWindowState.Minimized:
                self.WindowState = FormWindowState.Normal
            self.notifyIcon.Visible = False

if __name__ == "__main__":
    main = Main()
    Application.EnableVisualStyles()
    Application.Run(main)

Posted by Davy Mitchell on 2007-09-03 22:16:36.
Categories: IronPython, Python Tags :
Like this post? Digg it or Del.icio.us it. |



Japanese Chess, Maps and Spies Permalink

Wow. Weeks since the last blog. Been getting back to work after the summer hols and things have been busy. Busy with some fun stuff too.

Another Nintendo DS has joined the gadget family - this time a black one for me. Marta has had a DS for 8 months now so we have a little games collection already. Mario64 is fun and Brain training is good. My favourite has to be '42 All Time Classics' which is a mix of card, board and action games. Lots of variety and makes it easy to learn new games - today I played Japanese Chess for the first time. I also picked up a cheap copy of Golden Eye : Rogue Agent. It has mixed reviews but its pretty fun so far especially for a Bond fan like me!! There's some cool Homebrew (and Stackless Python) which I may get into if it has a decent web browser.

Staying with things portable, Google Maps is out for the Pocket PC. It works fairly well on my iPaq and is smoother than the web browser base version. Reinforces my belief in Desktop applications being Net enabled.

Posted by Davy Mitchell on 2007-09-01 14:11:01.
Categories: NintendoDS, Python Tags :    
Like this post? Digg it or Del.icio.us it. |




Locations of visitors to this page