https://wiki.wxpython.org/How to install wxPython

pip install -U wxPython

  

验证版本

D:\python>python
Python 3.6.2 (v3.6.2:5fd33b5, Jul 8 2017, 04:14:34) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
>>> wx.VERSION_STRING
'4.0.0a3'
>>> exit
Use exit() or Ctrl-Z plus Return to exit
>>> exit()

  

Hello World

https://www.wxpython.org/pages/overview/

#!/bin/python
"""
Hello World, but with more meat.
""" import wx class HelloFrame(wx.Frame):
"""
A Frame that says Hello World
""" def __init__(self, *args, **kw):
# ensure the parent's __init__ is called
super(HelloFrame, self).__init__(*args, **kw) # create a panel in the frame
pnl = wx.Panel(self) # and put some text with a larger bold font on it
st = wx.StaticText(pnl, label="Hello World!", pos=(25,25))
font = st.GetFont()
font.PointSize += 10
font = font.Bold()
st.SetFont(font) # create a menu bar
self.makeMenuBar() # and a status bar
self.CreateStatusBar()
self.SetStatusText("Welcome to wxPython!") def makeMenuBar(self):
"""
A menu bar is composed of menus, which are composed of menu items.
This method builds a set of menus and binds handlers to be called
when the menu item is selected.
""" # Make a file menu with Hello and Exit items
fileMenu = wx.Menu()
# The "\t..." syntax defines an accelerator key that also triggers
# the same event
helloItem = fileMenu.Append(-1, "&Hello...\tCtrl-H",
"Help string shown in status bar for this menu item")
fileMenu.AppendSeparator()
# When using a stock ID we don't need to specify the menu item's
# label
exitItem = fileMenu.Append(wx.ID_EXIT) # Now a help menu for the about item
helpMenu = wx.Menu()
aboutItem = helpMenu.Append(wx.ID_ABOUT) # Make the menu bar and add the two menus to it. The '&' defines
# that the next letter is the "mnemonic" for the menu item. On the
# platforms that support it those letters are underlined and can be
# triggered from the keyboard.
menuBar = wx.MenuBar()
menuBar.Append(fileMenu, "&File")
menuBar.Append(helpMenu, "&Help") # Give the menu bar to the frame
self.SetMenuBar(menuBar) # Finally, associate a handler function with the EVT_MENU event for
# each of the menu items. That means that when that menu item is
# activated then the associated handler function will be called.
self.Bind(wx.EVT_MENU, self.OnHello, helloItem)
self.Bind(wx.EVT_MENU, self.OnExit, exitItem)
self.Bind(wx.EVT_MENU, self.OnAbout, aboutItem) def OnExit(self, event):
"""Close the frame, terminating the application."""
self.Close(True) def OnHello(self, event):
"""Say hello to the user."""
wx.MessageBox("Hello again from wxPython") def OnAbout(self, event):
"""Display an About Dialog"""
wx.MessageBox("This is a wxPython Hello World sample",
"About Hello World 2",
wx.OK|wx.ICON_INFORMATION) if __name__ == '__main__':
# When this module is run (not imported) then create the app, the
# frame, show it, and start the event loop.
app = wx.App()
frm = HelloFrame(None, title='Hello World 2')
frm.Show()
app.MainLoop()

 

使用指导 https://wiki.wxpython.org/Getting Started

 

API参考 https://docs.wxpython.org/

wxPython安装使用的更多相关文章

  1. wxpython安装,demo下载

    wxPython介绍      wxPython是Python语言的一套优秀的GUI图形库.wxPython可以很方便的创建完整的.功能键全的GUI用户界面. wxPython安装 本安装采用pip自 ...

  2. wxPython安装错误问题:No module named wx

    今天心血来潮安装wxPython,本机win7,且已经安装Python,版本为2.7.3,然后IDE使用的PyCharm,然后wxPython下载的版本为:wxPython2.8-win32-unic ...

  3. wxpython 安装教程

    wxpython在windows 上的安装,需要在wxpython官网上下载对应的版本:Python分为32和64位系统不是系统的32位和64位 所以可以先在IDE 下输入Python看下当前是32还 ...

  4. 26-python图形化插件 wxpython安装时的问题

    最实在而又最实用的的安装方式pip,且必须习惯使用的方式,会同步安装相关的依赖包: pip install -U wxPython 总是包超时的错误:于是更新了pip 之后还是不行,于是改为了下面的命 ...

  5. wxPython 安装 及参考文档

    三种操作平台上的安装方法 1.windows 和 mac pip install -U wxPython 2.linux pip install -U -f https://extras.wxpyth ...

  6. 配置Robot Framework 环境时如何查看wxPython是否成功安装

    配置Robot Framework,win10系统,安装版本分别如下:

  7. RobotFramework 安装配置(一)

    服务器接口的测试框架的选择,最后选中了 RobotFramework ,原因一:能有效的管理测试用例,,支持批量执行,能实现关键字驱动或者数据驱动.原因二:支持测试人员可以使用Python和java创 ...

  8. 解决mac-osx10.11下无法安装wxPython2.8-osx-unicode-2.8.12.1的问题

    在mac-osx10.11版本下,安装RIDE前提需要装wxPython2.8-osx-unicode-2.8.12.1库,但在安装wxPython过程中,会提示安装失败,以下提供一种解决方案 这里我 ...

  9. RIDE安装操作

    转载参考https://www.cnblogs.com/Ming8006/p/4998492.html 一.python安装 1.访问Python官网:https://www.python.org/  ...

随机推荐

  1. Kafka查看偏移量报错:WARN WARNING: ConsumerOffsetChecker is deprecated and will be dropped in releases following 0.9.0. Use ConsumerGroupCommand instead.

    Kafka0.9版本后,命令ConsumerOffsetChecker已弃用,用新的命令来查. // 列表 bin/kafka-consumer-groups.sh --zookeeper local ...

  2. subscription group permisson

  3. TCP和UDP比較

    一.TCP/IP协议 TCP/IP协议,你一定常常听说吧,当中TCP(Transmission Control Protocol)称为传输控制协议,IP(Internet Protocol)称为因特网 ...

  4. CStdioFile类学习笔记<转>

    本文转自:http://www.cnblogs.com/JiMuStudio/archive/2011/07/17/2108496.html   CStdioFile类的声明保存再afx.h头文件中. ...

  5. 用jQuery和PHP来实现转盘抽奖程序

    准备工作 首先要准备素材,抽奖的界面用到两张图片,圆盘图片和指针图片,实际应用中可以根据不同的需求制作不同的圆盘图片. 接着制作html页面,实例中我们在body中加入如下代码: <div cl ...

  6. Mylyn--谁用谁知道!

    Mylyn――谁用谁知道!http://www.blogjava.net/alwayscy/archive/2008/06/15/208022.html 此文是我之Mylyn初体验,不搞大而全,而只把 ...

  7. 02-4设置第一启动项--U盘装系统中bios怎么设置USB启动

    整个U盘启动里最关键的一步就是设置U盘启动了,本教程内只是以特定型号的电脑为例进行演示,鉴于各种电脑不同BIOS设置U盘启动各有差异,所以如果下面的演示不能适用于你的电脑,建议去百度或者谷歌搜索一下你 ...

  8. Mac 上的终端神器 iTerm2

    官方下载地址:http://www.iterm2.com/ 主题下载地址:https://github.com/mbadolato/iTerm2-Color-Schemes 第三方教程推荐:http: ...

  9. opengl剪裁空间和视口空间中不遵从右手定则,而是遵从左手定则

    opengl剪裁空间和视口空间中不遵从右手定则,而是遵从左手定则. 比如说要在视口空间判断一个三角形是否是正面朝向用户,就需要用左手定则而非右手定则.

  10. Camera2/HAL3

    Android Camera HAL3中拍照Capture模式下多模块间的交互与帧Result与帧数据回调https://blog.csdn.net/gzzaigcnforever/article/d ...