wxpython

In wxPython what is the difference between event.Skip() and event.Veto()?

微笑、不失礼 提交于 2020-02-04 04:42:45
问题 I have a NOTEBOOK with the following event: self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGING, self.OnPageChanging) What is the diffrance between the following codes? def OnPageChanging(self, event): try: if ..... do some actions... event.Veto() return except: pass and def OnPageChanging(self, event): try: if ..... do some actions... event.Skip() return except: pass In this guide: http://zetcode.com/wxpython/events/ it says: Sometimes we need to stop processing an event. To do this, we call the method

In wxPython what is the difference between event.Skip() and event.Veto()?

江枫思渺然 提交于 2020-02-04 04:42:08
问题 I have a NOTEBOOK with the following event: self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGING, self.OnPageChanging) What is the diffrance between the following codes? def OnPageChanging(self, event): try: if ..... do some actions... event.Veto() return except: pass and def OnPageChanging(self, event): try: if ..... do some actions... event.Skip() return except: pass In this guide: http://zetcode.com/wxpython/events/ it says: Sometimes we need to stop processing an event. To do this, we call the method

matplotlib: how to refresh figure.canvas

喜夏-厌秋 提交于 2020-01-31 04:23:05
问题 I can't understand how to refresh FigureCanvasWxAgg instance. Here is the example: import wx import matplotlib from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas from matplotlib.figure import Figure class MainFrame(wx.Frame): def __init__(self): wx.Frame.__init__(self, None, wx.NewId(), "Main") self.sizer = wx.BoxSizer(wx.VERTICAL) self.figure = Figure(figsize=(1,2)) self.axe = self.figure.add_subplot(111) self.figurecanvas = FigureCanvas(self, -1, self.figure)

Replot figure only at the end of a panel resize event

孤者浪人 提交于 2020-01-30 06:30:07
问题 I'm currently trying to improve plotting part of a software. We are using WXPython and Matplotlib in order to show user many plots with various controls over them. To sum up, here is the context: Matplotlib performance is fine for our plotting needs, however, resizing our wxpython main frame is resizing wx panels that contains matplotlib canvas. (At each step or the resizing, and not only at the end) Resizing panels if fast, but matplotlib is also redrawing canvas and figures at each steps of

How to load a heavy model when using MVC design pattern

心已入冬 提交于 2020-01-30 03:45:15
问题 I'm building an application with wxPython and a Deep Learning model that I created using Tensorflow. The design pattern that I'm using is MVC. My problem is that the deep learning model is very heavy and it takes a very long time to load (like ~2 minutes) and in the meantime the GUI hangs. I created a sample code that describes the process. Here is what the GUI looks like while loading: enter image description here and this is what the GUI looks like after the loading: enter image description

wxPython笔记:窗口添加滚动条

只谈情不闲聊 提交于 2020-01-26 16:09:33
转载:https://www.cnblogs.com/evilloop/archive/2013/01/30/2883838.html wxpython的默认窗体类wx.Frame并不带滚动条 如果需要滚动条,需要在初始化的时候进行设定 下边是一个示例: #coding=utf8 import wx class MsgWindow(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title, pos=(640,0)) #重要的就下边两句 self.scroller = wx.ScrolledWindow(self, -1) self.scroller.SetScrollbars(1, 1, 1440, 900) self.pnl = pnl = wx.Panel(self.scroller) self.ms = ms = wx.BoxSizer(wx.VERTICAL) self.SetMinSize((300,640)) self.pnl.SetSizer(self.ms) self.ms.Fit(self) if __name__ == '__main__': app = wx.App(redirect=False) msg_win = MsgWindow

wxPython Panel in existing window: slow and small

怎甘沉沦 提交于 2020-01-25 12:32:10
问题 I'm experiencing very different behavior when creating a wx.Panel depending on whether the main window's already called Show(). With the below code, the application opens quickly with MainPanel created & populated before MainFrame.Show() . Using "New" to re-create it has multi-second lag while it re-makes the 200 texts. Also the MainPanel doesn't expand to take up the whole size of the window until the window is resized. This is definitely an issue with panel creation rather than panel

How to wxPanel.Refresh?

核能气质少年 提交于 2020-01-25 10:14:03
问题 I have a background in C# (.NET2.0) desktop application development and for the last years C for microcontrollers. Now for GUI applications on Linux and Windows, I'm learning python through wxPython. I'm on Linux Mint 19 Mate, Python 2.7, wxPython 3.0, wxGlade 0.8.0-1, Stani's Python Editor 0.8.4. wxGlade created some GUI code and I coded a bit of event handling into it. My problem is that my code calls wxPanel.Refresh() on a mouse event but the panel doesn't get refreshed. I know that the

wxPython, capturing an output from subprocess in real-time

巧了我就是萌 提交于 2020-01-24 21:06:02
问题 I'm working on application in wxPython which is a GUI for a command line utility. In the GUI there is a text control which should display the output from the application. I'm launching the shell command using subprocess, but I don't get any output from it until it has completed. I have tried several solutions but none of them seems to work. Below is the code I'm using at the moment (updated): def onOk(self,event): self.getControl('infotxt').Clear() try: thread = threading.Thread(target=self

wxPython, capturing an output from subprocess in real-time

送分小仙女□ 提交于 2020-01-24 21:05:07
问题 I'm working on application in wxPython which is a GUI for a command line utility. In the GUI there is a text control which should display the output from the application. I'm launching the shell command using subprocess, but I don't get any output from it until it has completed. I have tried several solutions but none of them seems to work. Below is the code I'm using at the moment (updated): def onOk(self,event): self.getControl('infotxt').Clear() try: thread = threading.Thread(target=self