wxpython

Python: queue without blocking

这一生的挚爱 提交于 2019-12-25 03:15:18
问题 I have a question about queues. I am creating a GUI with wxpython, and in the program I need to do something in a separate thread. After the thread finished, I have to modify the gui. The GUI should not block while the other thread is running. For this I thougt about queues and wrote something like this: def do_something(gui): # Here it normally does something gui.queue.put(gui.new) class GuiFrame(wx.Frame): def __init__(self, parent, id): wx.Frame.__init__(self, parent, id, title="Test")

matplotlib mouseclick event in pie chart

痴心易碎 提交于 2019-12-25 03:00:31
问题 Is there a way in matplotlib and Python to return the value/label clicked in a pie chart. For example if user clicks on sliver A of pie chart, return value A. If user clicks on sliver B of B pie chart, return value B. 回答1: from matplotlib import pyplot as plt # make a square figure and axes plt.figure(figsize=(6,6)) ax = plt.axes([0.1, 0.1, 0.8, 0.8]) labels = 'Frogs', 'Hogs', 'Dogs', 'Logs' fracs = [15,30,45, 10] explode=(0, 0.05, 0, 0) p = plt.pie(fracs, explode=explode, labels=labels,

Repeated calls to ArcMap Python Add-In with wxPython fail after one successful call

北慕城南 提交于 2019-12-25 02:34:05
问题 I have written a Python Add-In for ArcGIS program ArcMap that uses the wxPython package to generate a wx.Frame window with multiple controls, including an Exit button that closes the window. The Add-in works as intended the first time I run it, and I can close the wx.Frame window using the button without any errors. However, after a variable number of times running the Add-in, I get a fatal error on running the Add-In again. (Sometimes it fails the second time I run it. Sometimes I can run it

wxPython CSheet issue and replacement

心不动则不痛 提交于 2019-12-25 01:59:52
问题 I want to add spreadsheet functionality to my wxpython application running on Windows. The CSheet module seems broken in the latest 2.9 version. It shows: TypeError: EndEdit() takes exactly 4 arguments (5 given) May I know if there is any suggestions to fix it or any other python module with good spreadsheet functionality ? I tried some but most of them are built on top of CSheet. Thanks. 回答1: CSheet appears to just be a sub-class of Grid, so you could probably just use the Grid widget. Or

Is it possible to change the colour of the “focus selector” of a ListCtrl?

。_饼干妹妹 提交于 2019-12-25 01:51:48
问题 In Mozilla Thunderbird mail you can assing items in a list a colour. The "focus selector" usually has the "cursor colour" that is defined by the window theme on your OS. Now, when you select a coloured item in Thunderbird, the focus cursor changes colour accordingly. That is to indicate that this item has a colour. Otherwise the user could only see that this particular item has a colour by moving away the "focus selector". Now, is this possible in WxWindows, a WxListCtrl? Apart from changing

Cannot run WebGL content on WebView

旧城冷巷雨未停 提交于 2019-12-25 01:38:47
问题 I am trying to open a webpage with WebGL content from wxPython WebView. The engine used by WebView, webkit , has WebGL support. How can I render the the WebGL content inside WebView? The complete code used by me: import wx import wx.html2 class MyBrowser(wx.Frame): def __init__(self, *args, **kwds): wx.Frame.__init__(self, *args, **kwds) sizer = wx.BoxSizer(wx.VERTICAL) self.browser = wx.html2.WebView.New(self) sizer.Add(self.browser, 1, wx.EXPAND, 10) self.SetSizer(sizer) self.Maximize() if

How to get the details of an event in wxPython

非 Y 不嫁゛ 提交于 2019-12-25 01:21:34
问题 I have a section of code which returns events generated by a slider. I bind the event with self.Bind(wx.EVT_SCROLL,self.OnSlide) . The code which handles the event reads something like: def OnSlide(self,event): widget = event.GetEventObject() This is great but an error gets thrown every time the code is executed. It reads: AttributeError: 'PyEventBinder' object has no attribute 'GetEventObject' I want to be able to see which of the sliders generated the event but the error appears every time

Install wxpython using buildout and virtualenv

荒凉一梦 提交于 2019-12-25 01:07:30
问题 I want to have a repeatable and isolated install for a wxpython project on linux , so i thought that using virtualenv + buildout would be the way to go. Is there a buildout recipe available for this? The link install wxpython in buildout seems to be gone :( 回答1: That link works for me. Maybe it was just down temporarily. 来源: https://stackoverflow.com/questions/5415930/install-wxpython-using-buildout-and-virtualenv

WxPython: Periodically set value in TextCtrl not working

房东的猫 提交于 2019-12-25 00:59:13
问题 I am new to Python and OOP, usually do C & VHDL. I have to periodically display a value in a “window”, but can’t seem to make it. As is, the value is only fetched once and Quit doesn't work. I tried to modify it based on many posts that I have read, but I can’t get it to work. Any help would be much appreciated. This is my second post ever on a forum. Please inform if my post is not as it should be. Using Python 2.7, wxPython 2.8, Windows 7 import wx import threading class RspBox(wx.Frame):

wxPython and ARCGIS

微笑、不失礼 提交于 2019-12-25 00:06:58
问题 I am working on an Desktop application built with wx Python. I would like the application to visualize maps(shapefiles) like a GIS software and provide interactions with the map. I was looking through arcpy and arcgisscripting but I am not sure if it help me render the shapefile on the Panel. Please do let me know if it is possible? 回答1: There is an application created with wxPython for GIS here: http://thuban.intevation.org/ There's also one for GRASS: http://grass.osgeo.org/wiki/WxPython