wxpython

Give wx.StaticBitmap a transparent background? wxpython

感情迁移 提交于 2019-12-24 06:44:07
问题 I have an image that has a white background, how can I make this background invisible? Its in a wx.StaticBitmap wx.StaticBitmap(self, bitmap=wx.Bitmap('images/myimage.png'),pos=(0,0)) 回答1: By invisible, I assume you mean transparent so that whatever is behind the image shines through. This is not a function of widgets, but whatever you use to edit your image. You don't say! I use microsoft visual studio. Here's a screenshot. Notice how the background, shown in a sort of blue-green in the

Call functions from within a wxPython event handler

北城余情 提交于 2019-12-24 04:29:08
问题 I'm struggling to find a way to use function from within a wxPython event handler function. Say I have a button that when clicked it runs a function called OnRun using an event handler. However, the user forgot to click a RadionButton before the OnRun button and I want to pop-up a MessageDialog telling them they forgot a step. I'm going to reuse this MessageDialog several times, thus rather than doing a copy/paste of the same code I would like to just have this MessageDialog in a function and

Using wxPython Rich text control

╄→гoц情女王★ 提交于 2019-12-24 03:12:39
问题 I am using a rtf control to display text. I cannot understand the rtf control object structure. How do you get text into the rtf buffer? I have accessed the buffer and added an xml handler. Where do I go from there? import wx import wx.richtext as rt class MainFrame(wx.Frame): """Create MainFrame class.""" def __init__(self): """Initialise the class.""" wx.Frame.__init__(self, None, -1, 'Demonstrate wxPython Rich Text') self.panel = MainPanel(self) self.refresh_rtf(self.raw_xml()) self.Centre

How to write wxPython textCtrl focus event

 ̄綄美尐妖づ 提交于 2019-12-24 03:10:12
问题 I'm trying to fire a line of code when the user clicks on a textCtrl. The end goal is to highlight the contents of the box when it is clicked on. I am aware that this is possible with wx.EVT_SET_FOCUS, but it's either buggy or I'm implementing it wrong. Here's my code: self.m_textCtrl1 = wx.TextCtrl(self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(100,-1), wx.TE_LEFT) self.m_textCtrl1.SetMaxLength(8) self.m_textCtrl1.SetMinSize(wx.Size(100,-1)) self.m_textCtrl1.SetMaxSize

wxPython: displaying multiple widgets in same frame

ⅰ亾dé卋堺 提交于 2019-12-24 01:27:40
问题 I would like to be able to display Notebook and a TxtCtrl wx widgets in a single frame. Below is an example adapted from the wxpython wiki; is it possible to change their layout (maybe with something like wx.SplitterWindow ) to display the text box below the Notebook in the same frame? import wx import wx.lib.sheet as sheet class MySheet(sheet.CSheet): def __init__(self, parent): sheet.CSheet.__init__(self, parent) self.SetLabelBackgroundColour('#CCFF66') self.SetNumberRows(50) self

Figure Size & Position after Matplotlib Zoom

北城余情 提交于 2019-12-24 00:58:14
问题 I have a matplotlib image plot within a wxPython panel that I zoom in on using the native matplotlib toolbar zoom. Having zoomed in I wish to know the size of the resulting image so that I can calculate the magnification. Moreover, I wish to know the position/dimensions of my zoomed in image in relation to the original image so that I can re-plot it again at a later time. I don't know how to approach this. I have looked over documentation for canvas and figure but haven't found anything which

Breaking a video into frames with python

久未见 提交于 2019-12-24 00:48:23
问题 I am trying to write a program that deletes frames of a video that don't have a particular symbol in them. My general plan: Split the audio from the video Split the video into frames Run the frames through a subroutine that looks for the symbol, by checking the pixels where it should be for being the correct color, and logging the ones that don't. Delete those frames and corresponding audio seconds Splices it all back together. I need some help finding libraries that can do this. I was

Arranging the panels automatically in wxPython

依然范特西╮ 提交于 2019-12-24 00:35:39
问题 Level: Beginner I am developing a GUI with wxPython on Windows OS. I have some problems with arranging the panels. I GUI looks like below image (Of course the menu bar and the title bar is omitted in the image). I would take some time to explain how I create this GUI. First I get the screen size with the wx.DisplaySize() . Then I adjust my panels accordingly using pos=() . There are main 4 panels named panel-1 to panel-4. Each of this panels contains subpanels. The number of subpanels is not

How can I open two different pylab figures from the same button from a wxpython gui?

喜欢而已 提交于 2019-12-24 00:33:23
问题 I am new to python and I have a serious problem that I cannot overcome. I have created a gui using wxpython that has two text fields and a button. When this button is pressed I call a function that call another function which creates a pie figure according to the input in text boxes. The problem is that if the user do not close the figure and enter new values to the textboxes and press again the button, the program crash instead of showing a second figure. I tried to create different threads

Error Importing wxPython

你离开我真会死。 提交于 2019-12-24 00:02:49
问题 I've just installed wxPython with no problems. I'm on a Snow Leopard Mac using Python 2.6 and downloaded the corresponding wxPython version. I've started by typing a very basic wxPython app, but I'm getting the following error: ImportError: No module named wx The code is the following: import wx class Application(wx.Frame): def __init__(self, parent, id): wx.Frame.__init__(self, parent, id, 'Hello World', size = (300, 200)) if __name__=='__main__': app = wx.PySimpelApp() frame = Application