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/ ...
随机推荐
- IE 下 input 不响应 change 事件的处理
很多时候,我们都需要通过 input 来上传文件,通过 change 事件获取用户上传的文件,然后做一些额外的处理,最后上传到服务器. 可是事情往往就是没有那么美好.是的,IE 下 input 在选择 ...
- TreeView 拖拽 增删改
using Endv.Tools; using System; using System.Data; using System.Drawing; using System.IO; using Syst ...
- 微信小程序 - 多地点标识(map)
演示如下: wxml <map id="map" scale="{{scale}}" controls="{{controls}}" ...
- ssh只读事务的管理
概念:从这一点设置的时间点开始(时间点a)到这个事务结束的过程中,其他事务所提交的数据,该事务将看不见!(查询中不会出现别人在时间点a之后提交的数据) 应用场合: 如果你一次执行单条查询语句,则没有必 ...
- 利用velocity.js将svg动起来
关于velocity.js Velocity.js是一款jquery动画引擎插件,它拥有与jquery中的$.animate()相同的API,还打包了颜色动画,转换,循环,easing效果,类动画.滚 ...
- DirectShow控制台输出和保存视频设备名称
#include "windows.h" #include "TCHAR.h" #include <dshow.h> #include <ve ...
- unity, write/read txt file
在Assets下新建文件夹StreamingAssets.然后下面代码可在其中生成test.txt文件,并读写: using UnityEngine;using System.Collections; ...
- springboot+thymeleaf打war包在外部tomcat运行
工程目录 pom文件注意点 <packaging>war</packaging> <dependency> <groupId>org.springfra ...
- Codeforces Round #240 (Div. 1)B---Mashmokh and ACM(水dp)
Mashmokh's boss, Bimokh, didn't like Mashmokh. So he fired him. Mashmokh decided to go to university ...
- Android解决button反复点击问题
public class BaseActivity extends Activity { protected boolean isDestroy; //防止反复点击设置的标志.涉及到点击打开其它Act ...