• wxpython 浏览器框架


    #!/usr/bin/python

    import wx
    from wx.lib.buttons import GenBitmapTextButton

    class Browser(wx.Frame):
    def __init__(self, parent, id, title):
    wx.Frame.__init__(self, parent, id, title, size=(450, 400))
    panel = wx.Panel(self, -1)
    panel.SetBackgroundColour('WHITE')

    menubar = wx.MenuBar()
    file = wx.Menu()
    file.Append(1, '&Quit', '')
    edit = wx.Menu()
    view = wx.Menu()
    go = wx.Menu()
    bookmarks = wx.Menu()
    tools = wx.Menu()
    help = wx.Menu()

    menubar.Append(file, '&File')
    menubar.Append(edit, '&Edit')
    menubar.Append(view, '&View')
    menubar.Append(go, '&Go')
    menubar.Append(bookmarks, '&Bookmarks')
    menubar.Append(tools, '&Tools')
    menubar.Append(help, '&Help')

    self.SetMenuBar(menubar)

    vbox = wx.BoxSizer(wx.VERTICAL)
    hbox1 = wx.BoxSizer(wx.HORIZONTAL)
    hbox2 = wx.BoxSizer(wx.HORIZONTAL)
    toolbar1 = wx.Panel(panel, -1, size=(-1, 40))
    back = wx.BitmapButton(toolbar1, -1, wx.Bitmap('icons/back.png'),
    style=wx.NO_BORDER)
    forward = wx.BitmapButton(toolbar1, -1, wx.Bitmap('icons/forward.png'),
    style=wx.NO_BORDER)
    refresh = wx.BitmapButton(toolbar1, -1, wx.Bitmap('icons/refresh.png'),
    style=wx.NO_BORDER)
    stop = wx.BitmapButton(toolbar1, -1, wx.Bitmap('icons/stop.png'),
    style=wx.NO_BORDER)
    home = wx.BitmapButton(toolbar1, -1, wx.Bitmap('icons/home.png'),
    style=wx.NO_BORDER)
    address = wx.ComboBox(toolbar1, -1, size=(50, -1))
    go = wx.BitmapButton(toolbar1, -1, wx.Bitmap('icons/go.png'),
    style=wx.NO_BORDER)
    text = wx.TextCtrl(toolbar1, -1, size=(150, -1))

    hbox1.Add(back)
    hbox1.Add(forward)
    hbox1.Add(refresh)
    hbox1.Add(stop)
    hbox1.Add(home)
    hbox1.Add(address, 1, wx.TOP, 4)
    hbox1.Add(go, 0, wx.TOP | wx.LEFT, 4)
    hbox1.Add(text, 0, wx.TOP | wx.RIGHT, 4)

    vbox.Add(toolbar1, 0, wx.EXPAND)
    line = wx.StaticLine(panel)
    vbox.Add(line, 0, wx.EXPAND)

    toolbar2 = wx.Panel(panel, -1, size=(-1, 30))
    bookmark1 = wx.BitmapButton(toolbar2, -1, wx.Bitmap('icons/love.png'),
    style=wx.NO_BORDER)
    bookmark2 = wx.BitmapButton(toolbar2, -1, wx.Bitmap('icons/books.png'),
    style=wx.NO_BORDER)
    bookmark3 = wx.BitmapButton(toolbar2, -1, wx.Bitmap('icons/sound.png'),
    style=wx.NO_BORDER)
    hbox2.Add(bookmark1, flag=wx.RIGHT, border=5)
    hbox2.Add(bookmark2, flag=wx.RIGHT, border=5)
    hbox2.Add(bookmark3)
    toolbar2.SetSizer(hbox2)
    vbox.Add(toolbar2, 0, wx.EXPAND)
    line = wx.StaticLine(panel)
    vbox.Add(line, 0, wx.EXPAND)

    panel.SetSizer(vbox)

    self.CreateStatusBar()
    self.Centre()
    self.Show(True)

    app = wx.App(0)
    Browser(None, -1, 'Browser')
    app.MainLoop()
  • 相关阅读:
    20165323《Java程序设计》第九周学习总结
    20165323 实验三 敏捷开发与XP实践
    20165323 结对编程之四则运算week2-整体总结
    20165334 20165311 20165329 实验四外设驱动程序设计
    实验四
    20165311 《信息安全系统设计基础》第七周学习
    20165311 《信息安全系统设计基础》第六周学习总结
    20165311 《信息安全系统设计基础》第四周学习总结
    20165311 20165334 20165329实验一 开发环境的熟悉
    2018 第三周 20165311 缓冲区溢出漏洞实验和第三周学习总结
  • 原文地址:https://www.cnblogs.com/wudeng/p/9051564.html
Copyright © 2020-2023  润新知