本文講解如何裝python的開發的命令行程序最小化到托盤的方法,并提供菜單操作功能。
上個月使用python實現了一個多功能抓圖工具,見[《Python:一個多功能的抓圖工具開發(附源碼)》](http://blog.csdn.net/dyx1024/article/details/7340903),此程序為一個命令行程序,windows下運行時會彈出一個cmd窗口,里面什么內容也沒有,用戶使用時直接按下快捷鍵進行操作。一直想著優化一下,今天想到是否以通過最小化到托盤,并提供菜單操作和快捷鍵操作兩種方式,這樣看起來就有點軟件的樣子了。
?Google了一下,發現了一個方法,具體內容見本文附錄部分。
? 直接上實現后的代碼:
?1、screenshot.py (此模塊提供截圖的各種方法,被主程序screen_tray.py引用)
~~~
#!/usr/bin/env python
#coding=gb2312
#此模塊主要提供抓圖功能,支持以下三種抓圖方式:
#1、抓取全屏,快捷鍵CTRL+F1
#2、抓取當前窗口,快捷鍵CTRL+F2
#3、抓取所選區域,快捷鍵CTRL+F3
#抓到之后,會自動彈出保存對話框,選擇路徑保存即可
#***********************
#更新記錄
#0.1 2012-03-10 create by dyx1024
#**********************
import pyhk
import wx
import os
import sys
from PIL import ImageGrab
import ctypes
import win32gui
import ctypes.wintypes
import screen_tray
def capture_fullscreen(SysTrayIcon):
'''
Function:全屏抓圖
Input:NONE
Output: NONE
author: socrates
blog:http://blog.csdn.net/dyx1024
date:2012-03-10
'''
#抓圖
pic = ImageGrab.grab()
#保存圖片
save_pic(pic)
def capture_current_windows(SysTrayIcon):
'''
Function:抓取當前窗口
Input:NONE
Output: NONE
author: socrates
blog:http://blog.csdn.net/dyx1024
date:2012-03-10
'''
#窗口結構
class RECT(ctypes.Structure):
_fields_ = [('left', ctypes.c_long),
('top', ctypes.c_long),
('right', ctypes.c_long),
('bottom', ctypes.c_long)]
def __str__(self):
return str((self.left, self.top, self.right, self.bottom))
rect = RECT()
#獲取當前窗口句柄
HWND = win32gui.GetForegroundWindow()
#取當前窗口坐標
ctypes.windll.user32.GetWindowRect(HWND,ctypes.byref(rect))
#調整坐標
rangle = (rect.left+2,rect.top+2,rect.right-2,rect.bottom-2)
#抓圖
pic = ImageGrab.grab(rangle)
#保存
save_pic(pic)
def capture_choose_windows(SysTrayIcon):
'''
Function:抓取選擇的區域,沒有自己寫這個,借用QQ抓圖功能
Input:NONE
Output: NONE
author: socrates
blog:http://blog.csdn.net/dyx1024
date:2012-03-10
'''
try:
#加載QQ抓圖使用的dll
dll_handle = ctypes.cdll.LoadLibrary('CameraDll.dll')
except Exception:
try:
#如果dll加載失敗,則換種方法使用,直接運行,如果還失敗,退出
os.system("Rundll32.exe CameraDll.dll, CameraSubArea")
except Exception:
return
else:
try:
#加載dll成功,則調用抓圖函數,注:沒有分析清楚這個函數帶的參數個數
#及類型,所以此語句執行后會報參數缺少4個字節,但不影響抓圖功能,所
#以直接忽略了些異常
dll_handle.CameraSubArea(0)
except Exception:
return
def save_pic(pic, filename = '未命令圖片.png'):
'''
Function:使用文件對框,保存圖片
Input:NONE
Output: NONE
author: socrates
blog:http://blog.csdn.net/dyx1024
date:2012-03-10
'''
app = wx.PySimpleApp()
wildcard = "PNG(*.png)|*.png"
dialog = wx.FileDialog(None, "Select a place", os.getcwd(),
filename, wildcard, wx.SAVE)
if dialog.ShowModal() == wx.ID_OK:
pic.save(dialog.GetPath().encode('gb2312'))
else:
pass
dialog.Destroy()
def screenshot_main():
'''
Function:主函數,注冊快捷鍵
Input:NONE
Output: NONE
author: socrates
blog:http://blog.csdn.net/dyx1024
date:2012-03-10
'''
#創建hotkey句柄
hot_handle = pyhk.pyhk()
#注冊抓取全屏快捷鍵CTRL+F1
hot_handle.addHotkey(['Ctrl', 'F1'], capture_fullscreen)
#注冊抓取當前窗口快捷鍵CTRL+F2
hot_handle.addHotkey(['Ctrl', 'F2'], capture_current_windows)
#注冊抓取所選區域快捷鍵CTRL+F3
hot_handle.addHotkey(['Ctrl', 'F3'], capture_choose_windows)
#開始運行
hot_handle.start()
~~~
2、screen_tray.py (此模塊為主程序,提供托盤及菜單功能,在各菜單項中調用1中的各函數,最后再調用1中的注冊快鍵鍵函數,來提供快捷鍵操作)
~~~
#!/usr/bin/env python
#coding=gb2312
import os
import sys
import win32api
import win32con
import win32gui_struct
import screenshot
try:
import winxpgui as win32gui
except ImportError:
import win32gui
class SysTrayIcon(object):
'''TODO'''
QUIT = 'QUIT'
SPECIAL_ACTIONS = [QUIT]
FIRST_ID = 1023
def __init__(self,
icon,
hover_text,
menu_options,
on_quit=None,
default_menu_index=None,
window_class_name=None,):
self.icon = icon
self.hover_text = hover_text
self.on_quit = on_quit
menu_options = menu_options + (('退出', None, self.QUIT),)
self._next_action_id = self.FIRST_ID
self.menu_actions_by_id = set()
self.menu_options = self._add_ids_to_menu_options(list(menu_options))
self.menu_actions_by_id = dict(self.menu_actions_by_id)
del self._next_action_id
self.default_menu_index = (default_menu_index or 0)
self.window_class_name = window_class_name or "SysTrayIconPy"
message_map = {win32gui.RegisterWindowMessage("TaskbarCreated"): self.restart,
win32con.WM_DESTROY: self.destroy,
win32con.WM_COMMAND: self.command,
win32con.WM_USER+20 : self.notify,}
# Register the Window class.
window_class = win32gui.WNDCLASS()
hinst = window_class.hInstance = win32gui.GetModuleHandle(None)
window_class.lpszClassName = self.window_class_name
window_class.style = win32con.CS_VREDRAW | win32con.CS_HREDRAW;
window_class.hCursor = win32gui.LoadCursor(0, win32con.IDC_ARROW)
window_class.hbrBackground = win32con.COLOR_WINDOW
window_class.lpfnWndProc = message_map # could also specify a wndproc.
classAtom = win32gui.RegisterClass(window_class)
# Create the Window.
style = win32con.WS_OVERLAPPED | win32con.WS_SYSMENU
self.hwnd = win32gui.CreateWindow(classAtom,
self.window_class_name,
style,
0,
0,
win32con.CW_USEDEFAULT,
win32con.CW_USEDEFAULT,
0,
0,
hinst,
None)
win32gui.UpdateWindow(self.hwnd)
self.notify_id = None
self.refresh_icon()
win32gui.PumpMessages()
def _add_ids_to_menu_options(self, menu_options):
result = []
for menu_option in menu_options:
option_text, option_icon, option_action = menu_option
if callable(option_action) or option_action in self.SPECIAL_ACTIONS:
self.menu_actions_by_id.add((self._next_action_id, option_action))
result.append(menu_option + (self._next_action_id,))
elif non_string_iterable(option_action):
result.append((option_text,
option_icon,
self._add_ids_to_menu_options(option_action),
self._next_action_id))
else:
print 'Unknown item', option_text, option_icon, option_action
self._next_action_id += 1
return result
def refresh_icon(self):
# Try and find a custom icon
hinst = win32gui.GetModuleHandle(None)
if os.path.isfile(self.icon):
icon_flags = win32con.LR_LOADFROMFILE | win32con.LR_DEFAULTSIZE
hicon = win32gui.LoadImage(hinst,
self.icon,
win32con.IMAGE_ICON,
0,
0,
icon_flags)
else:
print "Can't find icon file - using default."
hicon = win32gui.LoadIcon(0, win32con.IDI_APPLICATION)
if self.notify_id: message = win32gui.NIM_MODIFY
else: message = win32gui.NIM_ADD
self.notify_id = (self.hwnd,
0,
win32gui.NIF_ICON | win32gui.NIF_MESSAGE | win32gui.NIF_TIP,
win32con.WM_USER+20,
hicon,
self.hover_text)
win32gui.Shell_NotifyIcon(message, self.notify_id)
def restart(self, hwnd, msg, wparam, lparam):
self.refresh_icon()
def destroy(self, hwnd, msg, wparam, lparam):
if self.on_quit: self.on_quit(self)
nid = (self.hwnd, 0)
win32gui.Shell_NotifyIcon(win32gui.NIM_DELETE, nid)
win32gui.PostQuitMessage(0) # Terminate the app.
def notify(self, hwnd, msg, wparam, lparam):
if lparam==win32con.WM_LBUTTONDBLCLK:
self.execute_menu_option(self.default_menu_index + self.FIRST_ID)
elif lparam==win32con.WM_RBUTTONUP:
self.show_menu()
elif lparam==win32con.WM_LBUTTONUP:
pass
return True
def show_menu(self):
menu = win32gui.CreatePopupMenu()
self.create_menu(menu, self.menu_options)
#win32gui.SetMenuDefaultItem(menu, 1000, 0)
pos = win32gui.GetCursorPos()
# See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/menus_0hdi.asp
win32gui.SetForegroundWindow(self.hwnd)
win32gui.TrackPopupMenu(menu,
win32con.TPM_LEFTALIGN,
pos[0],
pos[1],
0,
self.hwnd,
None)
win32gui.PostMessage(self.hwnd, win32con.WM_NULL, 0, 0)
def create_menu(self, menu, menu_options):
for option_text, option_icon, option_action, option_id in menu_options[::-1]:
if option_icon:
option_icon = self.prep_menu_icon(option_icon)
if option_id in self.menu_actions_by_id:
item, extras = win32gui_struct.PackMENUITEMINFO(text=option_text,
hbmpItem=option_icon,
wID=option_id)
win32gui.InsertMenuItem(menu, 0, 1, item)
else:
submenu = win32gui.CreatePopupMenu()
self.create_menu(submenu, option_action)
item, extras = win32gui_struct.PackMENUITEMINFO(text=option_text,
hbmpItem=option_icon,
hSubMenu=submenu)
win32gui.InsertMenuItem(menu, 0, 1, item)
def prep_menu_icon(self, icon):
# First load the icon.
ico_x = win32api.GetSystemMetrics(win32con.SM_CXSMICON)
ico_y = win32api.GetSystemMetrics(win32con.SM_CYSMICON)
hicon = win32gui.LoadImage(0, icon, win32con.IMAGE_ICON, ico_x, ico_y, win32con.LR_LOADFROMFILE)
hdcBitmap = win32gui.CreateCompatibleDC(0)
hdcScreen = win32gui.GetDC(0)
hbm = win32gui.CreateCompatibleBitmap(hdcScreen, ico_x, ico_y)
hbmOld = win32gui.SelectObject(hdcBitmap, hbm)
# Fill the background.
brush = win32gui.GetSysColorBrush(win32con.COLOR_MENU)
win32gui.FillRect(hdcBitmap, (0, 0, 16, 16), brush)
# unclear if brush needs to be feed. Best clue I can find is:
# "GetSysColorBrush returns a cached brush instead of allocating a new
# one." - implies no DeleteObject
# draw the icon
win32gui.DrawIconEx(hdcBitmap, 0, 0, hicon, ico_x, ico_y, 0, 0, win32con.DI_NORMAL)
win32gui.SelectObject(hdcBitmap, hbmOld)
win32gui.DeleteDC(hdcBitmap)
return hbm
def command(self, hwnd, msg, wparam, lparam):
id = win32gui.LOWORD(wparam)
self.execute_menu_option(id)
def execute_menu_option(self, id):
menu_action = self.menu_actions_by_id[id]
if menu_action == self.QUIT:
win32gui.DestroyWindow(self.hwnd)
else:
menu_action(self)
def non_string_iterable(obj):
try:
iter(obj)
except TypeError:
return False
else:
return not isinstance(obj, basestring)
# Minimal self test. You'll need a bunch of ICO files in the current working
# directory in order for this to work...
if __name__ == '__main__':
import itertools, glob
icons = 'screenshot_tray.ico'
hover_text = "多功能抓圖工具"
menu_options = (('抓取全屏', icons, screenshot.capture_fullscreen),
('抓取當前窗口', icons, screenshot.capture_current_windows),
('抓取所選區域', icons, screenshot.capture_choose_windows)
)
def bye(sysTrayIcon): print '退出'
SysTrayIcon(icons, hover_text, menu_options, on_quit=bye)
#提供快捷鍵操作
screenshot.screenshot_main()
~~~
3、執行screen_tray.py,托盤出現菜單項,各功能運行正常,快捷鍵功能正常,如下圖。
?
4、附:
本文所使用托盤模塊下載地址:[http://www.brunningonline.net/simon/blog/archives/SysTrayIcon.py.html](http://www.brunningonline.net/simon/blog/archives/SysTrayIcon.py.html)
附內容:?
~~~
#!/usr/bin/env python
# Module : SysTrayIcon.py
# Synopsis : Windows System tray icon.
# Programmer : Simon Brunning - simon@brunningonline.net
# Date : 11 April 2005
# Notes : Based on (i.e. ripped off from) Mark Hammond's
# win32gui_taskbar.py and win32gui_menu.py demos from PyWin32
'''TODO
For now, the demo at the bottom shows how to use it...'''
import os
import sys
import win32api
import win32con
import win32gui_struct
try:
import winxpgui as win32gui
except ImportError:
import win32gui
class SysTrayIcon(object):
'''TODO'''
QUIT = 'QUIT'
SPECIAL_ACTIONS = [QUIT]
FIRST_ID = 1023
def __init__(self,
icon,
hover_text,
menu_options,
on_quit=None,
default_menu_index=None,
window_class_name=None,):
self.icon = icon
self.hover_text = hover_text
self.on_quit = on_quit
menu_options = menu_options + (('Quit', None, self.QUIT),)
self._next_action_id = self.FIRST_ID
self.menu_actions_by_id = set()
self.menu_options = self._add_ids_to_menu_options(list(menu_options))
self.menu_actions_by_id = dict(self.menu_actions_by_id)
del self._next_action_id
self.default_menu_index = (default_menu_index or 0)
self.window_class_name = window_class_name or "SysTrayIconPy"
message_map = {win32gui.RegisterWindowMessage("TaskbarCreated"): self.restart,
win32con.WM_DESTROY: self.destroy,
win32con.WM_COMMAND: self.command,
win32con.WM_USER+20 : self.notify,}
# Register the Window class.
window_class = win32gui.WNDCLASS()
hinst = window_class.hInstance = win32gui.GetModuleHandle(None)
window_class.lpszClassName = self.window_class_name
window_class.style = win32con.CS_VREDRAW | win32con.CS_HREDRAW;
window_class.hCursor = win32gui.LoadCursor(0, win32con.IDC_ARROW)
window_class.hbrBackground = win32con.COLOR_WINDOW
window_class.lpfnWndProc = message_map # could also specify a wndproc.
classAtom = win32gui.RegisterClass(window_class)
# Create the Window.
style = win32con.WS_OVERLAPPED | win32con.WS_SYSMENU
self.hwnd = win32gui.CreateWindow(classAtom,
self.window_class_name,
style,
0,
0,
win32con.CW_USEDEFAULT,
win32con.CW_USEDEFAULT,
0,
0,
hinst,
None)
win32gui.UpdateWindow(self.hwnd)
self.notify_id = None
self.refresh_icon()
win32gui.PumpMessages()
def _add_ids_to_menu_options(self, menu_options):
result = []
for menu_option in menu_options:
option_text, option_icon, option_action = menu_option
if callable(option_action) or option_action in self.SPECIAL_ACTIONS:
self.menu_actions_by_id.add((self._next_action_id, option_action))
result.append(menu_option + (self._next_action_id,))
elif non_string_iterable(option_action):
result.append((option_text,
option_icon,
self._add_ids_to_menu_options(option_action),
self._next_action_id))
else:
print 'Unknown item', option_text, option_icon, option_action
self._next_action_id += 1
return result
def refresh_icon(self):
# Try and find a custom icon
hinst = win32gui.GetModuleHandle(None)
if os.path.isfile(self.icon):
icon_flags = win32con.LR_LOADFROMFILE | win32con.LR_DEFAULTSIZE
hicon = win32gui.LoadImage(hinst,
self.icon,
win32con.IMAGE_ICON,
0,
0,
icon_flags)
else:
print "Can't find icon file - using default."
hicon = win32gui.LoadIcon(0, win32con.IDI_APPLICATION)
if self.notify_id: message = win32gui.NIM_MODIFY
else: message = win32gui.NIM_ADD
self.notify_id = (self.hwnd,
0,
win32gui.NIF_ICON | win32gui.NIF_MESSAGE | win32gui.NIF_TIP,
win32con.WM_USER+20,
hicon,
self.hover_text)
win32gui.Shell_NotifyIcon(message, self.notify_id)
def restart(self, hwnd, msg, wparam, lparam):
self.refresh_icon()
def destroy(self, hwnd, msg, wparam, lparam):
if self.on_quit: self.on_quit(self)
nid = (self.hwnd, 0)
win32gui.Shell_NotifyIcon(win32gui.NIM_DELETE, nid)
win32gui.PostQuitMessage(0) # Terminate the app.
def notify(self, hwnd, msg, wparam, lparam):
if lparam==win32con.WM_LBUTTONDBLCLK:
self.execute_menu_option(self.default_menu_index + self.FIRST_ID)
elif lparam==win32con.WM_RBUTTONUP:
self.show_menu()
elif lparam==win32con.WM_LBUTTONUP:
pass
return True
def show_menu(self):
menu = win32gui.CreatePopupMenu()
self.create_menu(menu, self.menu_options)
#win32gui.SetMenuDefaultItem(menu, 1000, 0)
pos = win32gui.GetCursorPos()
# See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/menus_0hdi.asp
win32gui.SetForegroundWindow(self.hwnd)
win32gui.TrackPopupMenu(menu,
win32con.TPM_LEFTALIGN,
pos[0],
pos[1],
0,
self.hwnd,
None)
win32gui.PostMessage(self.hwnd, win32con.WM_NULL, 0, 0)
def create_menu(self, menu, menu_options):
for option_text, option_icon, option_action, option_id in menu_options[::-1]:
if option_icon:
option_icon = self.prep_menu_icon(option_icon)
if option_id in self.menu_actions_by_id:
item, extras = win32gui_struct.PackMENUITEMINFO(text=option_text,
hbmpItem=option_icon,
wID=option_id)
win32gui.InsertMenuItem(menu, 0, 1, item)
else:
submenu = win32gui.CreatePopupMenu()
self.create_menu(submenu, option_action)
item, extras = win32gui_struct.PackMENUITEMINFO(text=option_text,
hbmpItem=option_icon,
hSubMenu=submenu)
win32gui.InsertMenuItem(menu, 0, 1, item)
def prep_menu_icon(self, icon):
# First load the icon.
ico_x = win32api.GetSystemMetrics(win32con.SM_CXSMICON)
ico_y = win32api.GetSystemMetrics(win32con.SM_CYSMICON)
hicon = win32gui.LoadImage(0, icon, win32con.IMAGE_ICON, ico_x, ico_y, win32con.LR_LOADFROMFILE)
hdcBitmap = win32gui.CreateCompatibleDC(0)
hdcScreen = win32gui.GetDC(0)
hbm = win32gui.CreateCompatibleBitmap(hdcScreen, ico_x, ico_y)
hbmOld = win32gui.SelectObject(hdcBitmap, hbm)
# Fill the background.
brush = win32gui.GetSysColorBrush(win32con.COLOR_MENU)
win32gui.FillRect(hdcBitmap, (0, 0, 16, 16), brush)
# unclear if brush needs to be feed. Best clue I can find is:
# "GetSysColorBrush returns a cached brush instead of allocating a new
# one." - implies no DeleteObject
# draw the icon
win32gui.DrawIconEx(hdcBitmap, 0, 0, hicon, ico_x, ico_y, 0, 0, win32con.DI_NORMAL)
win32gui.SelectObject(hdcBitmap, hbmOld)
win32gui.DeleteDC(hdcBitmap)
return hbm
def command(self, hwnd, msg, wparam, lparam):
id = win32gui.LOWORD(wparam)
self.execute_menu_option(id)
def execute_menu_option(self, id):
menu_action = self.menu_actions_by_id[id]
if menu_action == self.QUIT:
win32gui.DestroyWindow(self.hwnd)
else:
menu_action(self)
def non_string_iterable(obj):
try:
iter(obj)
except TypeError:
return False
else:
return not isinstance(obj, basestring)
# Minimal self test. You'll need a bunch of ICO files in the current working
# directory in order for this to work...
if __name__ == '__main__':
import itertools, glob
icons = itertools.cycle(glob.glob('*.ico'))
hover_text = "SysTrayIcon.py Demo"
def hello(sysTrayIcon): print "Hello World."
def simon(sysTrayIcon): print "Hello Simon."
def switch_icon(sysTrayIcon):
sysTrayIcon.icon = icons.next()
sysTrayIcon.refresh_icon()
menu_options = (('Say Hello', icons.next(), hello),
('Switch Icon', None, switch_icon),
('A sub-menu', icons.next(), (('Say Hello to Simon', icons.next(), simon),
('Switch Icon', icons.next(), switch_icon),
))
)
def bye(sysTrayIcon): print 'Bye, then.'
SysTrayIcon(icons.next(), hover_text, menu_options, on_quit=bye, default_menu_index=1)
~~~
?
- 前言
- Python:實現文件歸檔
- Pyhon:按行輸出文件內容
- Python:讀文件和寫文件
- Python:實現一個小算法
- Python:通過命令行發送新浪微博
- Python:通過攝像頭實現的監控功能
- Python:通過攝像頭抓取圖像并自動上傳至新浪微博
- Python:簡單的攝像頭程序實現
- Python:日志模塊logging的應用
- Python:操作嵌入式數據庫SQLite
- Python:將句子中的單詞全部倒排過來,但單詞的字母順序不變
- Python:語音處理,實現在線朗讀RFC文檔或本地文本文件
- Python:通過計算階乘來學習lambda和reduce這兩個函數的使用
- Python:通過執行100萬次打印來比較C和python的性能,以及用C和python結合來解決性能問題的方法
- Python:使用matplotlib繪制圖表
- Python:使用pycha快速繪制辦公常用圖(餅圖、垂直直方圖、水平直方圖、散點圖等七種圖形)
- Python:使用pycha快速繪制辦公常用圖二(使用樣式定制個性化圖表)
- Python:監控鍵盤輸入、鼠標操作,并將捕獲到的信息記錄到文件中
- Python:通過獲取淘寶賬號和密碼的實驗,來看登陸方式選擇的重要性
- Python:通過獲取淘寶賬號和密碼的實驗,來看登陸方式選擇的重要性(二)
- Python:通過遠程監控用戶輸入來獲取淘寶賬號和密碼的實驗(一)
- Python:通過遠程監控用戶輸入來獲取淘寶賬號和密碼的實驗(二)
- Python:通過自定義系統級快捷鍵來控制程序運行
- Python:通過自定義系統級快捷鍵來控制程序開始或停止記錄日志(使用小技巧解決一個貌似無解的問題)
- Python:一個多功能的抓圖工具開發(附源碼)
- Python:程序發布方式簡介一(打包為可執行文件EXE)
- Python:新浪微博應用開發簡介(認證及授權部分)
- Python:程序最小化到托盤功能實現
- Python:實用抓圖工具開發介紹(含需求分析、設計、編碼、單元測試、打包、系統測試、發布各環節)
- Python:桌面氣泡提示功能實現
- Python:未來三個月的python學習計劃
- Python:pygame模塊及SDL庫簡介
- Python:獲取新浪微博用戶的收聽列表和粉絲列表
- Python:pygame游戲編程之旅一(Hello World)
- Python:pygame游戲編程之旅二(自由移動的小球)
- Python:pygame游戲編程之旅三(玩家控制的小球)
- Python:pygame游戲編程之旅四(游戲界面文字處理)
- Python:pygame游戲編程之旅五(游戲界面文字處理詳解)
- Python:pygame游戲編程之旅六(游戲中的聲音處理)
- Python:pygame游戲編程之旅七(pygame基礎知識講解1)
- Python:編程“八榮八恥”之我見
- Python:腳本的幾種執行方式
- wxPython:簡單的wxPython程序
- wxPython:簡單的wxPython程序的另一種寫法
- wxPython:應用程序對象介紹
- wxPython:輸出重定向
- wxPython:關閉wxPython程序
- wxPython:Frame類介紹
- wxPython:面板Panel的使用
- wxPython:工具欄、狀態欄、菜單實現
- wxPython:消息對話框MessageDialog
- wxPython:文本對話框TextEntryDialog
- wxPython:列表選擇框SingleChoiceDialog
- wxPython:事件處理介紹一
- wxPython:事件處理介紹二
- wxPython: 簡單的繪圖例子
- wxPython:狀態欄介紹
- wxPython:菜單介紹
- wxPython:文件對話框wx.FileDialog
- wxPython:顏色選擇對話框wx.ColourDialog
- wxPython:布局管理器sizer介紹
- wxPython:啟動畫面SplashScreen介紹
- wxPython:繪畫按鈕BitmapButton介紹
- wxPython:進度條Gauge介紹
- Python: 發送新浪微博(使用oauth2)
- Python:讀取新浪微博收聽列表
- Python:DNS客戶端實現