最近一直在学习Python的基础和一些常用的模块,现在该是付诸实践的时候了。
我打算做的第一个小工具是利用wxPython来创建一个登录小工具,这主要是减轻自己日常工作中的一些负担。具体需求是这样的,在出现工具的UI之后,用户可以选择自己要登录的页面,然后用户可以选择用户名,然后输入自己的密码,如果不输入,使用默认的密码。界面主要设置如下:一个主窗口,两个下拉框,其中一个用来选择登录的网页,另外一个选择用户名,一个输入框,一个按钮。

 Code
Code import wxPython,wx
import wxPython,wx
 class MyFrame(wx.Frame):
class MyFrame(wx.Frame): def __init__(self, parent, id, title):
    def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title)
        wx.Frame.__init__(self, parent, id, title) self.Bind(wx.EVT_MOVE, self.OnSelect)
        self.Bind(wx.EVT_MOVE, self.OnSelect) self.Bind(wx.Button, self.OnLogin)
        self.Bind(wx.Button, self.OnLogin)
 def OnSelect(self, event):
    def OnSelect(self, event):

 def OnLogin(self, event):
    def OnLogin(self, event):

 class MyApp(wx.App):
class MyApp(wx.App): def OnInit(self):
    def OnInit(self): frame = MyFrame(None, -1, "This is a test")
        frame = MyFrame(None, -1, "This is a test") frame.Show(True)
        frame.Show(True) return True
        return True
 def main():
def main(): app = MyApp(0)
    app = MyApp(0) app.MainLoop()
    app.MainLoop()
 if __name__ == "__main__":
if __name__ == "__main__": main()
    main()