wxpython

Byte stream and utf-8 in python 3

落爺英雄遲暮 提交于 2019-12-11 14:29:30
问题 I am reading a blob from a database which contains a png file. The blob looks correct and is of a bytes data type. It starts: b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x92\x00\x00\x00m\x08\x06\x00\x00\x00J\xbf8B\x00\x00\x00\x06bKGD\x00\x00\x00\x00\x00\x00\xf9C\xbb\x7f\x00\x00\x00\tpHYs\x00\x00\x0b\x13\x00\x00\ However, when I perform: image = wx.Image(blob) I get the message: UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte It seems to be

Is it possible to bind an event against a menu instead of a menu item in wxPython?

我们两清 提交于 2019-12-11 14:19:09
问题 Nothing to add 回答1: Do you want an event when your menu is opened? Use EVT_MENU_OPEN(func) ( wxMenuEvent ). But it's not in particular precise. As the documentation says, it is only sent once if you open a menu. For another event you have to close it and open another menu again. I.e in between, you can open other menus (by hovering other items in the menubar), and the event won't be sent again. What do you need this for? Probably there is another way to do it, instead of listening for this

Replace an Existing layout with new layout with wxPython

感情迁移 提交于 2019-12-11 14:16:56
问题 I am new to wxPython. I am making a layout with Gridbagsizer. I almost succeeded in making my desired layout. But for some unknown problem it is giving some problem. My objective: I made 5 layouts. Green, Red, Blue, Yellow and Black. When I double-click on "This is test run", the yellow layout is supposed to be replaced by black layout completely. What actually happens: Yellow gets replaced by black. No problem on that. But blue layouts position gets shifted to bottom for some reason. My code

How can I combine tkinter and wxpython without freezing window - python?

十年热恋 提交于 2019-12-11 14:15:57
问题 [PROBLEM] If I combine tkinter and wxpython then the app. window will freeze. Therefore please share a hint. I reckon that it has something to do with threads but I cannot quite put my finger on it. [CODE] from Tkinter import * master = Tk() def getFiles(): import wx app = wx.App(False) locale = wx.Locale(wx.LANGUAGE_ENGLISH) frame = wx.Frame(None, wx.ID_ANY, "test", style=wx.MINIMIZE_BOX | wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX | wx.CLIP_CHILDREN) frame.Center() frame.SetBackgroundColour

wxpython: Set Cursor to Absolute Screen Location And Click

戏子无情 提交于 2019-12-11 14:07:33
问题 I'm having a little trouble trying to get WarpPointer to work out appropriately for me. The scenario I'm trying to do is akin to recording a user's clicks and then replaying them on the screen. I've been able to record the screen motions and clicks without any issues; however, I'm stumbling when it comes to replaying what the user recorded. def MoveCursorAndClick(self, e): # get the current screen position sp = self.GetPosition() p = self.getNextPosition() # returned in absolute x,y from

How do I handle multiple EVT_TEXT events in wxPython?

岁酱吖の 提交于 2019-12-11 13:59:32
问题 This is one part of a two part question (other part is here) So here's what I'm looking for: A function which is bound to the EVT_TEXT event of a text control that waits a few seconds, then calls another function at the end of the delay time. Thats easy enough, but, I'd like it to reset the delay time every time a new EVT_TEXT event is generated. The effect I'm looking for is to have a user type into the text control, then after I assume they're done, I run the function described in the other

wxPython: Resizing a notebook within a notebook

試著忘記壹切 提交于 2019-12-11 13:47:25
问题 I have made a GUI where there are 4 main tabs, the 4 tabs are then split in half, with another notebook on the left and an empty panel on the right (a graph will go here). See image for below of my GUI. The problem I am having is that I cannot resize the notebook on the left to fit the contents of the notebook. By fitting its contents I mean I want the right hand side of the notebook to be pulled in. I also want the size to remain fixed so If I resized the window by clicking and dragging the

How to I disable the text ctrl when I select the combo box to a particular value?

ぃ、小莉子 提交于 2019-12-11 13:36:28
问题 I want to achieve the effect that when I select the ComboBox to anonymous , the TextCtrl grays out. I want the TextCtrl object be local to the method set_name , I don't want tc be a member of the entire class. That is, how can I achieve this without change tc as self.tc ? If it is possible, I also don't want to merge the two methods select_user_type and set_name as a single one. import wx class Example(wx.Frame): def __init__(self, title): super().__init__(None, title=title) self.panel = wx

wx.App (wxPython) crash when calling

僤鯓⒐⒋嵵緔 提交于 2019-12-11 13:22:07
问题 Recently I installed wxPython to do some works under Windows. Most of the time I work in Linux so I have a little experience here. with python.exe interpreter, I just do 2 line of code import wx tmp=wx.App(False) Then the interpreter crashed with Windows error reporting. I tried both python 2.7.1 and 2.6.6 with wxPython 2.8.11, all come from their main website, still no luck. Is there something I must do after install Python in Windows ? I can see that python install just fine and can do some

How Do I Make a GUI Open with the Correct Size with wxPython?

独自空忆成欢 提交于 2019-12-11 13:16:42
问题 I'm having trouble with the sizing of my window. When first opening the GUI, the initial size only shows a portion of what's in the window; its too small. Scroll bars are present so I can get to the information, but I want it to open with the correct size, rather than having to drag it diagonally so that all the information will be visible. Also, when expanding the window size, the appearance of the buttons glitches and the wording gets all choppy-like. How can I change the sizers/scrolling