pythonÏ߳̽»Á÷ - °¤ÌßÖ°ÑÄ / ²ÅÈëÖ°³¡
תÌû£º
import sys
from wxPython.wx import *
from wxPython.lib import newevent
DispatchEvent, EVT_DISPATCH = newevent.NewEvent()
class GenericDispatchMixin:
def __init__(self):
EVT_DISPATCH(self, self.OnDispatchEvent)
def OnDispatchEvent(self, event):
event.method(*event.arguments)
def ThreadSafeDispatch(self, method, *arguments):
wxPostEvent(self, DispatchEvent(method = method, arguments = arguments))
import wx
import time
import threading
import Queue
import traceback
import sys
from GenericDispatch import GenericDispatchMixin
class MainApp(wx.App):
def OnInit(self):
self.frame = MainFrame()
self.frame.Show(True)
self.SetTopWindow(self.frame)
return True
class MainFrame(wx.Frame, GenericDispatchMixin):
def __init__(self):
wx.Frame.__init__(self, None, -1, u¡¯³¤ÔËÐвâÊÔ¡¯)
GenericDispatchMixin.__init__(self)
box = wx.BoxSizer(wx.HORIZONTAL)
self.ID_BTN = wx.NewId()
self.btn = wx.Button(self, self.ID_BTN, u¡¯¿ªÊ¼¡¯, size=(60, 22))
box.Add(self.btn, 0, wx.ALIGN_CENTRE|wx.ALL, 0)
Ïà¹ØÎÊ´ð£º
ÔÚlistÖÐÌí¼ÓÒ»¸öÀàµÄ¾Ö²¿±äÁ¿ ÕâÑù×öÊÇ·ñºÏ·¨ Çë¿´ÏÂÃæÀý×Ó:
Python code:
class A():
def __init__( self ):
self.__a = 0
self.__b = 'hello'
def get_a( self ):
ret ......
pythonµÄPIL¿â×Ô´øµÄ·½·¨Ö»ÄܽøÐоØÐεÄÇиÈç¹ûÎÒÓÐÁËÒ»¸ö¶à±ßÐθ÷¸ö¶¥µãµÄ×ø±ê£¬ÈçºÎ¶ÔÏÖÓеÄͼƬ°´ÕÕÕâ¸ö¶à±ßÐνøÐÐÇиîÄØ£¿
²»Ò»¶¨ÒªÓÃPIL¿â£¬ÈκÎÄÜʵÏÖÕâ¸ö¹¦Äܵķ½·¨¶¼ÐС£
ͼƬÇиîµÄjs²»ÊǺܶàÂð£¿
......
×î½üÃÔÉÏÁËPython£¬ÔÚ˼¿¼ÔõÑùÓÃPythonд¸ö³ÌÐòʵÏÖ¶ÔÖ¸¶¨ÍøÂç¶Ë¿ÚµÄÊý¾Ý°üµÄץȡºÍ½âÎö£¬¿ÒÇë¸ßÊÖÖ¸½Ì£¡£¡
ÄãºÃ£¡
Ê×ÏÈ£¬ÊµÏÖ²¶°üµÄ¹¦ÄÜÐèҪʹÓÃwincap£¨windowsÏ£©£¬»òÕßlibpcap£¨LinuxÏ£©¡£
¶øPythonÌṩÁ ......
Traceback (most recent call last):
File "C:\test.py", line 80, in <module>
cur.execute("update userdata set kb=0 where strAccountID='%s'" % name)
......