ดูจากการ code นะครับก็เลยเกิดอาการสงสัยอย่างแรง
แบบที่ 1
import wx
class MyFrame(wx.Frame):
......
class MyApp(wx.App):
......
app = MyApp(0)
app.MainLoop()
แบบที่ 2
from wxPython.wx import *
class MyFrame(wxFrame):
......
class MyApp(wxApp):
......
app = MyApp(0)
app.MainLoop()
ซึ่งผมดูจากการ import แล้วลองรันโปรแกรมดูได้เหมือนกัน
แต่การ coding ต่างกันมากเลยครับเลยไม่รู้ว่าจะเอาแบบไหนดี
เผื่อจะได้ง่ายในการ convert เป็น code ในอนาคตเป็น Version 3 และแบบไหนเป็นแบบใหม่มากที่สุดครับ
พอดีไปอ่า
preecha13 Sat, 11/10/2008 - 16:38
พอดีไปอ่านเจอครับ ตกลงแบบแรกคือแบบใหม่นั่นเองครับ หาตั้งนาน
The wx Namespace
The second phase of the wx Namespace Transition has begun. That means that the real names of the classes and other symbols do not have the 'wx' prefix and the modules are located in a Python package named wx. There is still a Python package named wxPython with modules that have the names with the wx prefix for backwards compatibility. Instead of dynamically changing the names at module load time like in 2.4, the compatibility modules are generated at build time and contain assignment statements like this:
wxWindow = wx._core.Window
Don't let the "_core" in the name bother you. That and some other modules are implementation details, and everything that was in the wxPython.wx module before will still be in the wx package namespace after this change. So from your code you would use it as wx.Window or wxWindow if you import from the wxPython.wx module.
อืมน่าสนใ
khao_lek Mon, 13/10/2008 - 00:04
อืมน่าสนใจ ขอบคุณนะครับ ไม่ได้ตามมานานละ