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/ ...
随机推荐
- javascript 的事件绑定和取消事件
研究fabricjs中发现,它提供canvas.on('mousemove', hh) 来绑定事件, 提供 canvas.off()来取消绑定事件这样的接口,很是方便, 那我们就不妨探究一下内在的实现 ...
- 爪哇国新游记之二十二----排序判断重复时间复杂度为2n的位图法
import java.util.ArrayList; import java.util.List; /** * 位图法 * 用于整型数组判重复,得到无重复列表 * */ public class B ...
- linux 修改时间
实例:设置时间伟2008年8月8号12:00# date -s "2008-08-08 12:00:00"修改完后,记得执行clock -w,把系统时间写入CMOS date -s ...
- PHP-手册阅读
配置选项: html_errors: 无意义的 HTML 标记符会使得出错信息很凌乱, 所以在外壳下阅读报错信息是十分困难的, 因此将该选项的默认值改为 FALSE implicit_flush: 在 ...
- Note:pandas时间序列处理
Note 1.Time Series #1 from datetime import datetime now=datetime.now() now.year now.month now.day #2 ...
- 数据库性能优化之SQL语句优化1
一.问题的提出 在 应用系统开发初期,由于开发数据库数据比较少,对于查询SQL语句,复杂视图的的编写等体会不出SQL语句各种写法的性能优劣,但是如果将应用系统提交实 际应用后,随着数据库中数据的增加, ...
- nodejs 命令行交互
人机交互 function readSyncByfs(tips) { tips = tips || '> '; process.stdout.write(tips); process.stdin ...
- Html打印需要内容块(Js实现)
首先在head里面加入下面一段js代码: function preview(oper) { ) { bdhtml = window.document.body.innerHTML; //获取当前页的h ...
- Mat::operator =
Provides matrix assignment operators. C++: Mat& Mat::operator=(const Mat& m) C++: Mat& M ...
- elasticJob分片跑批
业务迅速发展带来了跑批数据量的急剧增加.单机处理跑批数据已不能满足需要,另考虑到企业处理数据的扩展能力,多机跑批势在必行.多机跑批是指将跑批任务分发到多台服务器上执行,多机跑批的前提是”数据分片”.e ...