wxpython

wx.Image is throwing PyAssertionError

为君一笑 提交于 2019-12-13 15:26:04
问题 I ran the following python code import wx class myframe(wx.Frame): def __init__(self): wx.Frame.__init__(self, None, -1, title="Hello") self.InitUI() def InitUI(self): menubar = wx.MenuBar() fileMenu = wx.Menu() qmi = wx.MenuItem(fileMenu, 100, '&Quit\tCtrl+Q') qmi.SetBitmap(wx.Image('quit.png', wx.BITMAP_TYPE_ANY).ConvertToBitmap()) fileMenu.AppendItem(qmi) self.Bind(wx.EVT_MENU, self.OnQuit, id=100) menubar.Append(fileMenu, '&File') self.SetMenuBar(menubar) self.SetSize((250, 200)) self

The right way to find the size of text in wxPython

谁都会走 提交于 2019-12-13 13:17:11
问题 I have an application I am developing in wxPython. Part of the application creates a large number of TextCtrls in a grid in order to enter four-letter codes for each day of the week for an arbitrarily large list of people. I've managed to make it work, but I'm having to do something kludgy. Specifically, I haven't found a good way to figure out how big (in pixels) a bit of text is, so I have to guess at sizing the TextCtrls in order to just fit the biggest (4 letter) code. My concern is that

Opening file - Performing a function

我怕爱的太早我们不能终老 提交于 2019-12-13 09:58:46
问题 I was wondering if someone could give me a direction on how to give functions to a file... This is a bit hard to explain, so I'll try my best. Let's say I have an application (using wxPython) and let's say that I have a file. Now this file is assigned to open with the application. So, I double-click the file and it opens the application. Now my question is, what would have to be written on the file to, for example, open up a dialog? So we double-click the file and it opens a dialog on the

wx Module misses attribute ArtProvider

一世执手 提交于 2019-12-13 08:53:31
问题 I am adapting a model in SUMO and try to run a file (sumopy_gui.py). When doing so I get the following error message: AttributeError: module 'wx' has no attribute 'ArtProvider_GetBitmap' I tried to update wx in the cmd line, reinstalling it, but I don't find a reason why wx shouldn't have this module. All the other modules seem to be working for now. Can someone help me please? Thanks 回答1: If you are using wxPython 4, then you want to use wx.ArtProvider.GetBitmap . Previous versions (i.e.

wxPython Window Maximize/restore

橙三吉。 提交于 2019-12-13 08:26:38
问题 After i minimize my window, how can i get it back up? The Iconize() must be mandatory. import wx class AAAA(wx.Frame): def __init__(self,parent,id): wx.Frame.__init__(self,parent,id,'Untitled',size=(450,395)) def minimizeProgram(event): print 'minimized' self.Iconize() self.Bind(wx.EVT_ICONIZE,minimizeProgram) if __name__=='__main__': app = wx.PySimpleApp() frame = AAAA(parent=None,id=-1) frame.Show() app.MainLoop() 回答1: Simply call wxWindow::Iconize(false) 来源: https://stackoverflow.com

wxPython Key Bindings don't work on Linux

拈花ヽ惹草 提交于 2019-12-13 07:57:08
问题 The following program works for me in Windows but not in Linux. There are no print statements displayed when I press the keys that I binded. However, the tab key can switch between the two buttons and the enter and space key toggle them. No other keys work. import wx class MyForm(wx.Frame): def __init__(self): wx.Frame.__init__(self, None, wx.ID_ANY, "Pressing dem keyz") # Add a panel so it looks the correct on all platforms panel = wx.Panel(self, wx.ID_ANY) self.btn = wx.ToggleButton(panel,

how use IEHtmlWindow widget change html form

白昼怎懂夜的黑 提交于 2019-12-13 07:03:25
问题 all i want to use wx.lib.iewin develop a soft. the soft include an ie frame and three buttons. when i click one button , the ie frame can click an url like 'google.com', and click another button can set some value in google.com 's search input form. and last button can click google.com 's search button. i know how to navigate google url. self.ie = iewin.IEHtmlWindow(self.panel_left,pos=wx.DefaultPosition, size=(465,560),style=wx.html.HW_SCROLLBAR_AUTO) self.ie.AddEventSink(self.panel_left)

Wxpython Keyboard binding

梦想与她 提交于 2019-12-13 06:59:56
问题 So I'm working on a rhythm trainer, and using wxpython as the UI Toolkit. I was wondering if anyone knew how to bind keyboard presses to play sounds? So to put it simply, users can use the keyboard to play a drum beat. Example "Pressing the A key will play the bass drum" Now I've come across a tutorial - http://www.blog.pythonlibrary.org/2009/08/29/wxpython-catching-key-and-char-events/ But this seems like it needs the button to successfully play the sound. I've got a bit of the functionality

Is it possible to dock wx.auiManager panes onto tops/bottoms of another panes?

放肆的年华 提交于 2019-12-13 06:43:13
问题 with this code: import wx import wx.aui class MyFrame(wx.Frame): def __init__(self, parent, id=-1, title='wx.aui Test', pos=wx.DefaultPosition, size=(800, 600), style=wx.DEFAULT_FRAME_STYLE): wx.Frame.__init__(self, parent, id, title, pos, size, style) self._mgr = wx.aui.AuiManager(self) # create several text controls text1 = wx.TextCtrl(self, -1, 'Pane 1 - sample text', wx.DefaultPosition, wx.Size(200,150), wx.NO_BORDER | wx.TE_MULTILINE) text2 = wx.TextCtrl(self, -1, 'Pane 2 - sample text',

Moving through toggle buttons using arrow keys

两盒软妹~` 提交于 2019-12-13 05:59:49
问题 As a follow-up question to my previous post I was wondering if there is a way to navigate through multiple toggle buttons using the arrow keys? My program needs to know which toggle button the user is currently selecting. 回答1: This is the final solution. I know this is not a very "pythonic" or even conventionally good solution but it works. #!/usr/bin/python import wx k = 0 Buttons = [] class Frame(wx.Frame): def __init__(self): wx.Frame.__init__(self,None, title = "Gonna Get Them Cursor Keys