wxpython

Can't import wx(Python) on Mac OS X

亡梦爱人 提交于 2019-12-12 12:35:57
问题 It is first time I'm using python on mac. I installed Python 2.7.1 from python.org and then wxPython2.8-osx-unicode-py2.7 (Mac OS X 10.6.6) I have no idea where they installed to, but anyway, that's what I get: Python 2.7.1 (r271:86882M, Nov 30 2010, 10:35:34) [GCC 4.2.1 (Apple Inc. build 5664)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import wx Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/wxPython

wx.Panel scales to fit entire parent Frame despite giving it a size

孤街浪徒 提交于 2019-12-12 12:14:12
问题 I am a newbie to wxpython . I am trying to have a Frame and within that a small panel area which I am coloring blue. However no matter what I do the wx.Panel using the size attribute, the single panel snaps to the size of its parent frame. If I add another panel (pane2 in code below) both panes are drawn in the correct size. I know I can control these panels using sizers. But I was trying to understand why the wx.Panel bject behaves the way it does when it's all alone. Here is the code:

Slim down Python wxPython OS X app built with py2app?

一世执手 提交于 2019-12-12 09:16:06
问题 I have just made a small little app of a Python wxPython script with py2app. Everything worked as advertised, but the app is pretty big in size. Is there any way to optimize py2app to make the app smaller in size? 回答1: This is a workaround. It will depend on which OS you want to target. Python and wxPython are bundled with every Mac OS X installation (at least starting with Leopard, if I recall correctly) What you might try, is to add the --alias compilation option. According to the py2app

Running winpdb from within Enthought Canopy on MacOS 10.9.2

时光总嘲笑我的痴心妄想 提交于 2019-12-12 09:15:38
问题 I have Enthought Canopy 1.4 installed on MacOS 10.9.2. Trying to run the winpdb debugger results in the following message: This program needs access to the screen. Please run with a Framework build of python, and only when you are logged in on the main display of your Mac. As a workaround, I tried creating a shell script run.sh , containing PYVER=2.7 PYTHON=/System/Library/Frameworks/Python.framework/Versions/$PYVER/bin/python$PYVER # find the root of the virtualenv, it should be the parent

Getting total/free RAM from within Python

只谈情不闲聊 提交于 2019-12-12 07:51:49
问题 From within a Python application, how can I get the total amount of RAM of the system and how much of it is currently free, in a cross-platform way? Ideally, the amount of free RAM should consider only physical memory that can actually be allocated to the Python process. 回答1: Have you tried SIGAR - System Information Gatherer And Reporter? After install import os, sigar sg = sigar.open() mem = sg.mem() sg.close() print mem.total() / 1024, mem.free() / 1024 Hope this helps 回答2: psutil would be

How to change my wxpython program that read and display rain sensor data from mcp3008 to software spi?

淺唱寂寞╮ 提交于 2019-12-12 06:54:02
问题 I have a completed wxpython code that can read data from rain sensor and convert it from analogue to digital with mcp3008. The problem is the current raspberry pi that I use, already has a 20x4 lcd display that uses pin 24 or GPIO 8 which I need for my rain sensor program. I have read from https://learn.adafruit.com/raspberry-pi-analog-to-digital-converters/mcp3008#software-spi on how to change my spi connection to software spi. Here is my mcp3008 pinout to raspberry pi without lcd display:

wxpython staticbox does not display

不问归期 提交于 2019-12-12 06:12:00
问题 I cannot get a static box to display under wx 2.8 on Linux Mint 17 platform. I fought for hours with this before going back to basics and trying the following code: #!/usr/bin/python import wx class MyDialog(wx.Dialog): def __init__(self, parent, id, title): wx.Dialog.__init__(self, parent, id, title, size=(250, 230)) wx.StaticBox(self, -1, 'Personal Info', (5, 5), size=(240, 170)) wx.CheckBox(self, -1 ,'Male', (15, 30)) wx.CheckBox(self, -1 ,'Married', (15, 55)) wx.StaticText(self, -1, 'Age'

wxPython SetMinSize problem

半世苍凉 提交于 2019-12-12 06:08:54
问题 Having problems setting the SetMinSize in wxPython. Can someone please help me getting this window not getting any smaller than it is in the startup? And/or making the window not allowing resize? I tried self.SetMinSize(GetSize()) after self.SetSizerAndFit(SizerH) in the MainPanel class. Did not work. I've looked and searched but to no help. Im also new to programming and can someone also comment on how the program is built up? Is it understandable and good? Or should measures be taken?

Read parameters like eta from youtube-dl

扶醉桌前 提交于 2019-12-12 05:43:52
问题 Hi I would like to read the output from youtube dl on cmd and put in my wxpython program. This is the function I used. def execute(self,command,textctrl): process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) output = '' # Poll process for new output until finished for line in iter(process.stdout.readline, ""): textctrl.AppendText(line) output += line process.wait() exitCode = process.returncode if (exitCode == 0): return output else: raise

wxPython CollapsiblePane strange clipping issue

夙愿已清 提交于 2019-12-12 05:37:17
问题 This is a follow up from allocating more size in sizer to wx.CollapsiblePane when expanded. EDIT : The answer to that question solved my original problem, which was that nothing moved when I expanded or collapsed a pane, but now I've encountered another bug. While things do move properly, the buttons seem to smear out over each other as shown in the image below. Mousing over a button seems to force it to redraw properly over the rest of the mess, but it leaves a bunch of random button pieces