wxpython

String or Unicode type required, wxPython StaticText

妖精的绣舞 提交于 2019-12-11 07:10:34
问题 I'm trying to make a wxPython static text widget. For some reason I keep getting the error below. Snippet: self.Label = wx.StaticText(self, pos=(sw/2.0 - w/2.0, sh/2.0 - h/2.0), label='hello') Error: ", line 238, in make_label self.Label = wx.StaticText(self, pos=(sw/2.0 - w/2.0, sh/2.0 - h/2.0), label='hello') File "C:\Python26\lib\site-packages\wx-2.8-msw-ansi\wx\_core.py", line 8500, in SetLabel return _core_.Window_SetLabel(*args, **kwargs) TypeError: String or Unicode type required 回答1:

Creating ScrolledWindow in wxPython

浪尽此生 提交于 2019-12-11 06:33:30
问题 I am trying to make a ScrolledWindow that can scroll over a grid of images, but the scrollbar isn't appearing. wxWidgets documentation says: The most automatic and newest way [to set the scrollbars in wxScrolledWindow] is to simply let sizers determine the scrolling area. This is now the default when you set an interior sizer into a wxScrolledWindow with wxWindow::SetSizer. The scrolling area will be set to the size requested by the sizer and the scrollbars will be assigned for each

How do I disable PythonWin's “Redirecting output to win32trace remote collector” feature without uninstalling PythonWin?

▼魔方 西西 提交于 2019-12-11 06:28:31
问题 When I run a wxPython application, it prints the string “Redirecting output to win32trace remote collector”and I must open PythonWin's trace collector tool to view that trace output. Since I'm not interested in collecting this output, how should I disable this feature? 回答1: You can even pass that when you instantiate your wx.App(): if __name__ == "__main__": app = wx.App(redirect=False) #or 0 app.MainLoop() wxPython wx.App docs 回答2: This message deceived me into thinking win32trace was

Radio button display and selection issue in wxPython

故事扮演 提交于 2019-12-11 06:22:44
问题 I am creating multi-column lists which are all equal in length and also generating number of radio buttons equal to the length of list. I have couple of issues: 1] Display issue: In following fig., I get radio buttons. But when I scroll down this is what happens. Following is a snippet of my code to generate it Please assist me to fix this issue so that I get full list of radio buttons displayed properly. w = 0 for i in range(1,len(lut_code)): w += 30 rb_G = wx.RadioButton(scroll1, -1, "G",

wxPython - StyledTextCtrl get currently visible lines

女生的网名这么多〃 提交于 2019-12-11 06:08:55
问题 I am still working on my text editor, and now I want to make it run faster. So I thought I may somehow get currently visible text, and parse it as I want. So is there a way to get currently visible lines? P.S. Or maybe there is another way to increase StyledTextCtrl's performance? Thanks. 回答1: Use GetFirstVisibleLine() to determine the first visible line. Lines are numbered starting at zero. Use LinesOnScreen() to determine how many lines are visible on the screen. You can use GetLine(line)

wxPython Scroll Panel Spacing Issue

走远了吗. 提交于 2019-12-11 05:35:42
问题 I have tried to follow question and answer from this site regarding making a scrolly window with bitmaps, but I can't get it behave how I expected it to. This is the panel code: class ScrollyPanel(wxScrolledPanel.ScrolledPanel): def __init__(self, parent): wxScrolledPanel.ScrolledPanel.__init__(self, parent, style=wx.VSCROLL, size=(200,200)) self.__sizer = wx.WrapSizer() self.SetupScrolling(scroll_x = False) self.addButton(200) self.SetSizer(self.__sizer) self.Bind(wx.EVT_SIZE, self.onSize)

Copy and paste rows in wxpython using a virtual ListCtrl

不羁岁月 提交于 2019-12-11 05:15:46
问题 I'm using a virtual ListCtrl in wxpython. I am trying to select several rows from the list and then copy / paste the row value to a text file, or possibly spreadsheet. How would I copy the selected rows to clipboard (using CTRL-C)? Which event should I bind? Thanks! 回答1: Looking at the wxPython demo for the list control, I think you'd have to do something like the following: index = self.list.GetFirstSelected() value = " %s: %s\n" % (self.list.GetItemText(index), self.getColumnText(index, 1))

How to save user text box input when user clicks 'ok' in python?

安稳与你 提交于 2019-12-11 04:48:35
问题 I am trying to make a pop up window that takes two text inputs and then when the user clicks 'ok', it records the data. My problem is when I try to define the function of when the 'ok' button is pressed, record the data. I get the AttributeError: 'apples' object has no attribute 'TextCtrlInstance' when I press ok. class apples(wx.Frame): def __init__(self,parent,id): wx.Frame.__init__(self,parent,id,'Add a stock',size=(300,300)) frames=wx.Panel(self) frames.Bind(wx.EVT_MOTION, self.OnMove)

Add scrollbars in wxpython, but it doesn't appear

久未见 提交于 2019-12-11 04:25:26
问题 I saw a lot of scrollbars on the web, but my situation is different, with more wx.FlexGridSizer objects.The scoller dosen't appear. class MPL_Frame(wx.Frame): """MPL_Frame可以继承,并可修改,或者直接使用""" # global task def __init__(self, title="MPL_Frame Example In wxPython", size=(1300, 500)): wx.Frame.__init__(self, parent=None, title=title, size=size) self.scroller = wx.ScrolledWindow(self, -1) self.scroller.SetScrollbars(1, 1, 640, 400) self.grid = DataGrid(self, (17, 16)) ship_grid = DataGrid(self,

Returning data to the original process that invoke a subprocess

不想你离开。 提交于 2019-12-11 04:20:03
问题 Someone told me to post this as a new question. This is a follow up to Instantiating a new WX Python GUI from spawn thread I implemented the following code to a script that gets called from a spawned thread (Thread2) # Function that gets invoked by Thread #2 def scriptFunction(): # Code to instantiate GUI2; GUI2 contains wx.TextCtrl fields and a 'Done' button p = subprocess.Popen("python secondGui.py", bufsize=2048, shell=True,stdin=subprocess.PIPE, stdout=subprocess.PIPE) # Wait for a