Ubuntu下有趣的漂亮的小程序实在是太多了,真想知道那些天才般的程序员是如何做到的,所以想学习linux下图形界面程序的开发。
校园网在访问国外网站时是很要命的,幸好同学有用网通上网的,先去找了一些教程和资料试着编了一个hello world小程序。正如预料的那样,出错是难免的!通过dir(gtk)查找函数再加上自己的一点猜测,竟把那个例子改好了,最后明白原来是那些例子是老版本gtk的,现在2.0版本的函数名称有很多都变了。gtkhello.py
from gtk
import *
# importing all the widgets from gtkwindow = Window(WINDOW_TOPLEVEL)
# create a top level window window.connect("
destroy", main_quit)
# quit the event loop on destruction window.set_border_width(10)
# set padding round child widget button = Button("
Hello World")
# A button with the "Hello World" label
window.add(button)
# add button to window window.show_all()
# Show the window with his widgetsmain()
# enter the main event loopLinux系统怎样自动加载windowsUbuntu 7.10比Mac更精彩!(组图)相关资讯 Ubuntu程序
- Ubuntu下PyGtk的开发之 Base.py (12/09/2007 08:46:17)
本文评论 查看全部评论 (0)