wxpython

Why Does .Hide()ing and .Show()ing Panels in wxPython Result in the Sizer Changing the Layout?

冷暖自知 提交于 2019-12-20 09:58:34
问题 As referenced in my previous question, I am trying to make something slightly wizard-like in function. I have settled on a single frame with a sizer added to it. I build panels for each of the screens I would like users to see, add them to the frame's sizer, then switch between panels by .Hide() ing one panel, then calling a custom .ShowYourself() on the next panel. Obviously, I would like the buttons to remain in the same place as the user progresses through the process. I have linked

Why does this wxPython GUI freeze when self.Destroy() is used instead of self.Close()? (example attached)

China☆狼群 提交于 2019-12-20 07:47:43
问题 LoginDialog is opened with self.loginButton , and upon closing it, the GUI freezes; the login button remains pressed, and there are only alert sounds when attempting to click on anything. LoginDialog() was from this tutorial, just augmented with the file-write line in onLogin (which isn't the problem source). All appears to work when switching from self.Destroy() to self.Close(). wxPython version is 3.0, Python 2.7.10 The following code is a working example of the issue: import wx # wxGlade

How to remove lines from stdout in Python - in SciTe, Idle, Eclipse or other editor with console

删除回忆录丶 提交于 2019-12-20 04:38:42
问题 For a standard Python Console window, you can remove the last line with for example sys.stdout.write('\r'+' '*len(line)) as I explained here. But for editors like SciTe, Idle or Eclipse (with PyDev), the stdout is a file-type object, probably flushing its content to the console window leaving its buffer empty and thus not allowing modify the content once it has appeared on in the window. What trick can be applied to, for example, erase the last line of such console? Is there a one-size-fits

How to move items smoothly in wxPython?

ε祈祈猫儿з 提交于 2019-12-20 03:51:32
问题 I am trying to drag and drop a button, with the following code in wxPython, however, the drag flickers, and feels jarring, and I'm not sure why -- or how to fix it. I've pored over the wxWidgets docs, but can't seem to find out what the problem is. Thanks in advance! import wx app = wx.App(False) d = {} def wMouseDown(e): print "!!!", e.GetEventObject() def MouseDown(e): o = e.GetEventObject() sx,sy = panel.ScreenToClient(o.GetPositionTuple()) dx,dy = panel.ScreenToClient(wx.GetMousePosition(

In wxPython, What is the Standard Process of Making an Application Slightly More Complex Than a Wizard?

徘徊边缘 提交于 2019-12-20 02:30:29
问题 I am attempting to create my first OS-level GUI using wxPython. I have the book wxPython in Action and have looked at the code demos. I have no experience with event-driven programming (aside from some Javascript), sizers, and all of the typical GUI elements. The book is organized a little strangely and assumes I know far more about OS GUI programming than I actually do. I'm fairly recent to object-oriented programming, as well. I'm aware that I am clearly out of my depth. My application, on

wxpython add line to TextCtrl

强颜欢笑 提交于 2019-12-19 22:35:55
问题 I have a multi line, read only TextCtrl in wxpython I know how to set values using myTextCtrl.SetValue('hello') But this will change whatever I previously had in my TextCtrl... How do I add a new line and keep whatever I had before? 回答1: Either widget.AppendText or widget.WriteText will write a new line each time if you send your string with a newline character (like 'hello\n') AppendText , would append the text at the end of the text in the control. WriteText is the same except because the

How to thread wxPython progress bar

Deadly 提交于 2019-12-19 11:34:30
问题 I'm trying to thread wx.ProgressDialog. I got a Progress threading class class Progress(threading.Thread): def __init__(self): threading.Thread.__init__(self) def run(self): max = 1000000 dlg = wx.ProgressDialog("Progress dialog example", "An informative message", maximum = max, parent=None, style = wx.PD_CAN_ABORT | wx.PD_APP_MODAL | wx.PD_ELAPSED_TIME | wx.PD_ESTIMATED_TIME | wx.PD_REMAINING_TIME ) keepGoing = True count = 0 while keepGoing and count < max: count += 1 wx.MilliSleep(250) if

wxPython non-blocking GUI threading AND multiprocessing?

若如初见. 提交于 2019-12-19 11:16:41
问题 Python 2.7.3 x64 wxPython 2.8 x64 Been reading quite a bit on python threading and multiprocessing, particularly some articles by Doug Hellmann, which have helped tremendously. However, I'm confused about one thing... I thought the Python multiprocessing module was more-or-less a drop-in replacement for the threading module, excepting that args must be picklable, but I'm finding that in order not to block my GUI, I must first create a new thread with threading.Thread then multiprocess within

Pygame Erasing Images on Backgrounds

ε祈祈猫儿з 提交于 2019-12-19 10:02:21
问题 You blit an image onto your surface to use as your background. Then you press button X to blit an image on the same surface, how do you erase the image? I have this so far, but then I end up with a white rectangle in the middle of my background. screen = pygame.display.set_mode(1280, 512) screen.blit(background, (0,0)) while True: pygame.display.flip() #flip is same as update for event in pygame.event.get(): if (event.type == pygame.KEYDOWN): if event.key == pygame.K_SPACE: screen.blit(player

matplotlib + wxpython not sizing correctly with legend

不打扰是莪最后的温柔 提交于 2019-12-19 09:49:37
问题 I have a matplotlib figure embedded in a wxpython frame with a few sizers. Everything works fine until I include a legend but then the sizers don't seem to be working with the legend. Even when I resize the window by dragging at the corner, the main figure changes size, but only the edge of the legend is ever shown. That is, note that the legend is not visible in the wxFrame. import wx import matplotlib as mpl from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as Canvas from