BV1AL 之無所不記

2009-02-23

Social networking 與健康威脅

http://www.theregister.co.uk/2009/02/20/social_networking_heath_threats/

"the isolation it causes can lead to measurable physical changes - destructive measurable physical changes."

"the number of people saying there is no one with whom they discuss important matters nearly tripled."

"Children now spend more time in the family home alone in front of TV/computer screens than doing anything else,"

"Social isolation, for example, has been shown to impair the genes involved in the development of leukocytes, those helpful cells that float around in your blood, fighting disease."

"Real-world friendships help prevent heart attacks."

2009-02-01

pygtk不用白不用

以前用過xdialog, 後來又用過zenity, 基本上就是幾種互動對話可以
搭配shell script 語法,簡單做出圖型介面, 但是這兩者有時在顯
示方面並不理想(xdialog 還要裝gtk-1.x 現在大部份程式都在用
gtk 2.x 了), 不如改用pygtk 來得划算。一來是多數系統裡都已安
裝了python 因此也大都包含了pygtk, 它跟shell script語法固然
不同,但從tutorial裡找一下便有對話的例子,稍微改一改就能上路。

awesome的好處是可以用按鍵做很多切換控制,但對按鍵不習慣也
不熟悉打字來呼叫程式的人,可以利用pygtk來寫些對話介面,從
tutorial裡的toggle button這個例子很快就能改成一個menu介面,
一開始先定義一個callback,透過os.system('%s&'%data) 叫它去
執行系統裡的某個程式, 再定義一個delete_event 來關閉介面, 接
下來定義一個__init__(self), 裡面就可以用這樣的幾行來增添更多
的項目,

button = gtk.ToggleButton("Firefox")
button.connect("toggled", self.callback, "iceweasel")
vbox.pack_start(button, True, True, 2)
button.show()

[這是故意show出名字是Firefox但執行iceweasel]

使用起來比 xdialog, zenity 簡潔美觀, 同時又俱script的即
寫即用,在這個python滿天下的時代,pygtk真是不用白不用。