This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import pygtk | |
pygtk.require ('2.0') | |
import gtk | |
from urllib2 import urlopen | |
from urllib import urlencode | |
import urllib2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import pygtk | |
pygtk.require ('2.0') | |
import gtk | |
import gobject | |
import pywapi | |
from threading import Thread |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from urllib2 import urlopen | |
from urllib import urlencode | |
import simplejson | |
import sys | |
def translate(text): | |
sl="zh-tw" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import pywapi | |
cities = pywapi.get_cities_from_google('tw', 'zh-tw') | |
for c in cities: | |
print "%s: " % (cities.index(c)+1), | |
print c['name'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import pygtk | |
pygtk.require ('2.0') | |
import gtk | |
class HelloWorld: | |
def __init__ (self): | |
window = gtk.Window () | |
window.connect ("destroy", self.destroy) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<interface> | |
<requires lib="gtk+" version="2.16"/> | |
<!-- interface-naming-policy project-wide --> | |
<object class="GtkWindow" id="window1"> | |
<property name="width_request">400</property> | |
<property name="height_request">400</property> | |
<signal name="delete_event" handler="on_window_delete_event"/> | |
<child> | |
<object class="GtkHBox" id="hbox1"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const St = imports.gi.St; | |
const Mainloop = imports.mainloop; | |
const PanelMenu = imports.ui.panelMenu; | |
const PopupMenu = imports.ui.popupMenu; | |
const Main = imports.ui.main; | |
function HelloWorldButton() { | |
this._init(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sample extension code, makes clicking on the panel show a message | |
const St = imports.gi.St; | |
const Mainloop = imports.mainloop; | |
const Main = imports.ui.main; | |
function _showHello() { | |
let text = new St.Label({ style_class: 'helloworld-label', text: "Hello, world!" }); | |
let monitor = global.get_primary_monitor(); | |
global.stage.add_actor(text); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Clutter = imports.gi.Clutter; | |
const Tweener = imports.tweener.tweener; | |
function click(actor, ev) { | |
let properties = { time: 1.0, | |
x: texture.x+100, | |
y: texture.y+100 | |
}; | |
Tweener.addTween(texture, properties); | |
print('Clicked!'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Gtk = imports.gi.Gtk; | |
function hello(widget) { | |
log("Hello World"); | |
} | |
function onDestroy(widget) { | |
log("destroy signal occurred"); | |
Gtk.main_quit(); | |
} |