wxPython安装使用
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安装使用的更多相关文章
- wxpython安装,demo下载
wxPython介绍 wxPython是Python语言的一套优秀的GUI图形库.wxPython可以很方便的创建完整的.功能键全的GUI用户界面. wxPython安装 本安装采用pip自 ...
- wxPython安装错误问题:No module named wx
今天心血来潮安装wxPython,本机win7,且已经安装Python,版本为2.7.3,然后IDE使用的PyCharm,然后wxPython下载的版本为:wxPython2.8-win32-unic ...
- wxpython 安装教程
wxpython在windows 上的安装,需要在wxpython官网上下载对应的版本:Python分为32和64位系统不是系统的32位和64位 所以可以先在IDE 下输入Python看下当前是32还 ...
- 26-python图形化插件 wxpython安装时的问题
最实在而又最实用的的安装方式pip,且必须习惯使用的方式,会同步安装相关的依赖包: pip install -U wxPython 总是包超时的错误:于是更新了pip 之后还是不行,于是改为了下面的命 ...
- wxPython 安装 及参考文档
三种操作平台上的安装方法 1.windows 和 mac pip install -U wxPython 2.linux pip install -U -f https://extras.wxpyth ...
- 配置Robot Framework 环境时如何查看wxPython是否成功安装
配置Robot Framework,win10系统,安装版本分别如下:
- RobotFramework 安装配置(一)
服务器接口的测试框架的选择,最后选中了 RobotFramework ,原因一:能有效的管理测试用例,,支持批量执行,能实现关键字驱动或者数据驱动.原因二:支持测试人员可以使用Python和java创 ...
- 解决mac-osx10.11下无法安装wxPython2.8-osx-unicode-2.8.12.1的问题
在mac-osx10.11版本下,安装RIDE前提需要装wxPython2.8-osx-unicode-2.8.12.1库,但在安装wxPython过程中,会提示安装失败,以下提供一种解决方案 这里我 ...
- RIDE安装操作
转载参考https://www.cnblogs.com/Ming8006/p/4998492.html 一.python安装 1.访问Python官网:https://www.python.org/ ...
随机推荐
- Redis使用记录
登陆:cd /usr/local/bin 启动客户端:./redis-cli 查看所有key:keys * 查看key类型:type keyname 查看list长度:LLEN KEY_NAME 清空 ...
- SSH框架优势
SSH框架优势 1. 典型的三层构架体现MVC(模型Model,视图View和控制)思想,可以让开发人员减轻重新建立解决复杂问题方案的负担和精力.便于敏捷开发出新的需求,降低开发时间成本. 2. ...
- CentOS6.5下docker的安装及遇到的问题和简单使用(已实践)
转载自 CentOS6下docker的安装和使用 Docker是一个开源的应用容器引擎,可以轻松的为任何应用创建一个轻量级的.可移植的.自给自足的容器.利用Linux的LXC.AUFS. Go语言.c ...
- (三)Oracle学习笔记—— sql语句
0. scott 用户默认表介绍 scott用户Tables目录下包含四张表 1. insert(插入)语句 给指定列插入数据: ,'xx'); 插入全部列数据: ,'xx','lll'); 2. u ...
- javascript 字符串对象新增 replaceAll 方法
String.prototype.replaceAll = function(reallyDo, replaceWith, ignoreCase) { if(! RegExp.prototype.is ...
- TCP/IP ---分层
TCP/IP的分层 ICMP是IP协议的附属协议.IP层用它来与其他主机或路由器交换错误报文和其他重要信息.尽管ICMP主要被IP使用,但应用程序也有可能访问它.我们将分析两个流行的诊断工具,Ping ...
- popupwindow从底部弹出
参考了网上的一些代码,自己写了个类,上代码 /** * Created by Lee on 2016/2/26. */ public class CameraPopupWindow { private ...
- 36氪Plus消息:贷款组合推荐工具“钱小二”已获数百万天使轮融资
根据"钱小二"在创业者社区36氪plus上的更新信息,该团队已获得数百万天使轮融资,投资方及投资时间不明. "钱小二"是一个贷款搜索 + 贷款组合推荐平台,目标 ...
- TCP通过哪些措施,保证传输可靠
TCP是通过什么方式来提供可靠传输的 (合理截断数据包,超时重发,校验,失序重新排序,能够丢弃重复数据,TCP可以进行流量控制) TCP提供一种面向连接的.可靠的字节流服务. 面向连接:意味着两个使 ...
- unity, 烘焙lightmap
1,建一个名为_scene的场景,放一个球体. 2,将球体的Static属性勾选. 3,将默认光源Directional light的Baking属性改为Baked. 4,打开Window->L ...