wxpython

An simple interface plotted by matplotlib and cartopy isn't showed in wxpython

这一生的挚爱 提交于 2020-01-05 05:46:07
问题 I'm completely a newcomer in wxpython.The following codes show a simple plot: #-*-coding:utf-8-*- import matplotlib.pyplot as plt import matplotlib.ticker as mticker import cartopy.crs as ccrs from cartopy.mpl.gridliner import LONGITUDE_FORMATTER, LATITUDE_FORMATTER from matplotlib.offsetbox import AnnotationBbox,OffsetImage from PIL import Image fig=plt.figure(figsize=(20,10)) ax = plt.axes(projection=ccrs.PlateCarree()) ax.coastlines() ax.stock_img() gl = ax.gridlines(crs=ccrs.PlateCarree()

How does wxpython exit Mainloop?

只谈情不闲聊 提交于 2020-01-04 20:48:50
问题 I have a wxpython application, it runs this way: if __name__ == "__main__": app = wx.App(False) frame = MainWindow("Application") frame.Show() app.MainLoop() there is an "exit" menu item on the application's menu bar, which binds: def onExit(self, event): """""" self.Close() When "exit" is clicked, what happens exactly? When "exit" is clicked, what happens to app.MainLoop()? Is clicking "X" button on top-right of the frame window same with clicking "exit" button? Why doesn't python.exe*32

how to drag image in a wxpython frame

对着背影说爱祢 提交于 2020-01-04 20:25:38
问题 what is the easiest way to drag an image ( or text) in a wx window ? i need steps or a small example on how to do that. thanx in advance 回答1: Take a look at the PseudoDC example in the wxPython demo. The sample displays some random shapes within the window which you can grab and move around, you should be able to apply the concepts for an image. You can download the win32-docs-demos from here 回答2: Install wxpython demos, there is DragImage demostration in it. 来源: https://stackoverflow.com

how to drag image in a wxpython frame

喜欢而已 提交于 2020-01-04 20:24:34
问题 what is the easiest way to drag an image ( or text) in a wx window ? i need steps or a small example on how to do that. thanx in advance 回答1: Take a look at the PseudoDC example in the wxPython demo. The sample displays some random shapes within the window which you can grab and move around, you should be able to apply the concepts for an image. You can download the win32-docs-demos from here 回答2: Install wxpython demos, there is DragImage demostration in it. 来源: https://stackoverflow.com

wxPython segmentation fault with Editors

梦想与她 提交于 2020-01-04 02:54:09
问题 I have created a wx.grid.Grid with a wx.grid.PyGridTableBase derived class to provide its data. I want to also to control the editors used on the table. Towards that end I defined the following method def GetAttr(self, row, col, kind): attr = wx.grid.GridCellAttr() if col == 0: attr.SetEditor( wx.grid.GridCellChoiceEditor() ) return attr However, this causes a segmentation fault whenever I attempt to created the editor in the grid. I did try creating the editor beforehand and passing it in as

Getting a WxPython panel item to expand

我们两清 提交于 2020-01-03 18:49:06
问题 I have a WxPython frame containing a single item, such as: class Panel(wx.Panel): def __init__(self, parent): wx.Panel.__init__(self, parent) self.text = wx.StaticText(self, label='Panel 1') I have a frame containing several panels, including this one, and dimensions are ruled by sizers. I would like this StaticText to expand. Using a BoxSizer containing just the text and setting the wx.EXPAND flag does the trick, but it seems silly to use a sizer just for one item. Any simpler solution? (I

wxPython draw text onto EXISTING bitmap or image

自古美人都是妖i 提交于 2020-01-03 15:35:08
问题 I'm trying to add a background image to some text, I'm hoping to do this by using MemoryDC to write text to an image which will then be placed in my GridSizer. Everything works as I want it to with the exception that I cannot use an existing image to draw text onto, I have to create a new, empty, bitmap which is pointless for me because it puts me back where I started. Here is my code, it places a white box into my GridSizer with text drawn onto it: w, h = 150,64 bmp = wx.EmptyBitmap(w,h) dc

wxPython draw text onto EXISTING bitmap or image

让人想犯罪 __ 提交于 2020-01-03 15:34:06
问题 I'm trying to add a background image to some text, I'm hoping to do this by using MemoryDC to write text to an image which will then be placed in my GridSizer. Everything works as I want it to with the exception that I cannot use an existing image to draw text onto, I have to create a new, empty, bitmap which is pointless for me because it puts me back where I started. Here is my code, it places a white box into my GridSizer with text drawn onto it: w, h = 150,64 bmp = wx.EmptyBitmap(w,h) dc

How to add an outline border to a widget?

邮差的信 提交于 2020-01-03 13:34:07
问题 How can I add a outline border to a widget in wxpython? (Any widget, for example, a wx.Button ) 回答1: For panel, you can use p = wx.Panel(....., style=wx.SUNKEN_BORDER) there you can choose from constants: wx.SIMPLE_BORDER wx.RAISED_BORDER wx.SUNKEN_BORDER wx.NO_BORDER If you want to create border around wx.Button , i would use my custom bitmap with wx.BitmapButton : b = wx.BitmapButton(pane, -1, wx.Bitmap('buttons/my_beautiful_button.png')) For any widget, i think you can always create a wx

How do I layout a 3 pane window using wxPython?

℡╲_俬逩灬. 提交于 2020-01-03 13:10:38
问题 I am trying to find a simple way to layout a 3 pane window using wxPython. I want to have a tree list in the left pane, then have a right pane that is split into two - with an edit component in the top part and a grid component in the bottom part. Something along the lines of: -------------------------------------- | | | | | Edit | | Tree | Control | | Control | | | |----------------------| | | | | | Grid | | | | -------------------------------------- I would like the window to be re-sizable