wxpython

how to draw into a PaintDC and MemoryDC in parallel?

随声附和 提交于 2019-12-25 06:31:37
问题 I'm looking for a pice of code, how to use a wx.PaintDC() and wx.MemoryDC in parallel. My wxPython is in version 2.8.12 and I do not get it work to draw to a wx.PaintDC() into a wx.Window, while also having a thread running, that draws to a wx.MemoryDC into a bitmap. Like this: def onPaint(self, evt): self.dc=wx.PaintDC(self) imgbuf, (sx, sy), self.refresh_needed=self.osm.getBitmap() self.dc.DrawBitmap(imgbuf, sx, sy) as_thread() w, h=self.__getBitmapSize() self.bmpbuf=wx.EmptyBitmapRGBA(w, h

How add already captured screenshot to wx.BoxSizer?

一世执手 提交于 2019-12-25 04:51:19
问题 My Python code: self.images = wx.StaticBitmap(self, id=-1, pos=wx.DefaultPosition, size=(200,150), style= wx.SUNKEN_BORDER) self.hbox = wx.BoxSizer(wx.HORIZONTAL) self.sizer.Add(self.hbox) # my main sizer #in function dynamically captured images bmp = wx.BitmapFromImage(image) self.images.SetBitmap(bmp) self.hbox.Add(self.images, 1, wx.EXPAND | wx.ALL, 3) ...and after I want to add next image (another - I don't want to replace older) I have information "Adding a window to the same sizer twice

Implementaion of particular cases in a mathtext to wxbitmap function

放肆的年华 提交于 2019-12-25 04:31:22
问题 I am displaying a bitmap like this using the code : mt =r'$\frac{%.5fx^{2} + %.5fx + %.5f}{%.5fx^{2} + %.5fx + %.5f}$'%(self.z1[-3],self.z1[-2],self.z1[-1],self.z3[-3],self.z3[-2],self.z3[-1]) bm = mathtext_to_wxbitmap(mt) self.picture.SetBitmap(bm) Here the function mathtext_to_wxbitmap is implemented as : from matplotlib.mathtext import MathTextParser mathtext_parser = MathTextParser("Bitmap") def mathtext_to_wxbitmap(s): ftimage, depth = mathtext_parser.parse(s, 150) return wx

Layout Management with wxPython

自闭症网瘾萝莉.ら 提交于 2019-12-25 04:24:23
问题 This new question is build on this I am having problem with managing the layout in wxPython. In this program I have two buttons in two layouts. But no matter what I do I cant change the position or alignment of those buttons. Those buttons got fixed in blue and yellow layout. My code goes like this: import wx class myframe(wx.Frame): def __init__(self): wx.Frame.__init__(self, None, size=(1000,700)) self.TitlePanel = wx.Panel(self, size=(350, 400)) self.TitlePanel.SetBackgroundColour("green")

wxPython making a panel not accessible through tab

∥☆過路亽.° 提交于 2019-12-25 04:03:11
问题 I built a gui using wx.glade. Part of this gui is a section to enter in passwords and then click a button to validate them. To make this section I used a grid sizer. Not every cell of the grid needed to have a button or field in it, so I filled these with wx.panel components as spacers. What happens is that as I tab through the tx fields and buttons everything is fine, but the wx.panel spacers are also part of that tab list. What I want to do is make them non-tab selectable. class MyFrame(wx

Why wxframe isn't raised from a function called with global gtk binder?

好久不见. 提交于 2019-12-25 03:53:45
问题 Ok, why this simple app dosn't work. I've spent one day investigating this and got nothing. import wx, os import gtk import keybinder class FrameWithHotKey(wx.Frame): def __init__(self, *args, **kwargs): wx.Frame.__init__(self, *args, **kwargs) keybinder.bind("<Ctrl>period", self.toggle_shown) def toggle_shown(self): # windowNow id if self.IsShown(): self.Hide() else: self.Show() self.Raise() if __name__ == '__main__': app = wx.PySimpleApp() frame = FrameWithHotKey(None) app.MainLoop() I don

Fails to set bgcolor on StaticText on Raspberry pi (but not in Win10)

徘徊边缘 提交于 2019-12-25 03:39:16
问题 I am trying to set the backgroundcolor of a StaticText in wxPython. I am using the method .SetBackgroundColour('Red') . That works as expected when I run my code on windows 10. However, when it runs on a Raspberry pi it fails to set the background colour (and the text alignment). Can someone help? Picture: Result on windows 10 Picture: Result on Raspberry pi 3b+ The code and a wheel file built on the raspberry for wxPython4.0.3 can be found on my Github: https://github.com/danneedebro/Problem

How to override the “Cancel” button event of a ProgressDialog?

旧巷老猫 提交于 2019-12-25 03:37:12
问题 The ProgressDialog class allows passing the option wx.PD_CAN_ABORT which adds a "Cancel" button to the dialog. I need to rebind the event bound to this button, to make it Destroy() the dialog instead of just "making the next call to Update() [to] return False" as the class's documentation describes. class PortScanProgressDialog(object): """Dialog showing progress of the port scan.""" def __init__(self): self.dialog = wx.ProgressDialog( "COM Port Scan", PORT_SCAN_DLG_MSG, MAX_COM_PORT, style

wxPython app: No error but still freezes

北战南征 提交于 2019-12-25 03:35:14
问题 I don't get any errors with my code, but after I hit the spam button it freezes and nothing happens. Does anyone see anything wrong with the code? import Skype4Py, wx, time as t skype = Skype4Py.Skype() skype.Attach() name = "" chat = "" message = "" class skyped(wx.Frame): def __init__(self,parent,id): wx.Frame.__init__(self,parent,id,"Skype Chat Spammer",size=(300,200)) panel=wx.Panel(self) start=wx.Button(panel,label="Spam!",pos=(140,100),size=(50,20)) stop=wx.Button(panel,label="Stop!",

wxPython app: No error but still freezes

喜欢而已 提交于 2019-12-25 03:35:03
问题 I don't get any errors with my code, but after I hit the spam button it freezes and nothing happens. Does anyone see anything wrong with the code? import Skype4Py, wx, time as t skype = Skype4Py.Skype() skype.Attach() name = "" chat = "" message = "" class skyped(wx.Frame): def __init__(self,parent,id): wx.Frame.__init__(self,parent,id,"Skype Chat Spammer",size=(300,200)) panel=wx.Panel(self) start=wx.Button(panel,label="Spam!",pos=(140,100),size=(50,20)) stop=wx.Button(panel,label="Stop!",