wxwidgets

wx.StaticText's label does not contract using SetSizerAndFit()

wx.StaticText's label does not contract using SetSizerAndFit() Question: I’d like to place a filename after the file is chosen and contract it if the file name is too long. Here is my code: import wx class Dlg(wx.Dialog): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.input_pnl = wx.Panel(self) self.choose_input = wx.Button(self.input_pnl, label=’Select’) self.input_filename = wx.StaticText(self.input_pnl, style=wx.ST_ELLIPSIZE_END) self.input_szr …

Total answers: 1

Opening a window on top of other windows

Opening a window on top of other windows Question: How to open a window on top of other windows when calling a function? import wx def openFile(wildcard="*"): app = wx.App(None) style = wx.FD_OPEN | wx.FD_FILE_MUST_EXIST dialog = wx.FileDialog(None, ‘Open’, wildcard=wildcard, style=style) if dialog.ShowModal() == wx.ID_OK: path = dialog.GetPath() else: dialog.Destroy() path = ‘No file’ return …

Total answers: 2

AddPrivateFont to App Title / Title bar in WxPython?

AddPrivateFont to App Title / Title bar in WxPython? Question: My problem is I can’t find the way to use AddPrivateFont to change the App Title font in WxPython. From the demo https://github.com/wxWidgets/Phoenix/blob/master/demo/AddPrivateFont.py and the sample https://wiki.wxpython.org/How%20to%20add%20a%20menu%20bar%20in%20the%20title%20bar%20%28Phoenix%29 I tried f = wx.Font( pointSize=18, family=wx.FONTFAMILY_DEFAULT, style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_NORMAL, underline=False, faceName="Youth Touch", encoding=wx.FONTENCODING_DEFAULT, ) xwq = self.SetAppName("Custom Gui …

Total answers: 1

Updating Old wxPython App: Invalid Window Calling Super/Parent Method

Updating Old wxPython App: Invalid Window Calling Super/Parent Method Question: I am trying to update an old app that was written for Python 2.7 with wxWidgets/wxPython 2.8. I am trying to make it compatible with my current system’s versions of Python (3.10) & wxPython (4.0). I have come across an error trying to call a …

Total answers: 2

Embedding VTK output in wxpanel with C++

Embedding VTK output in wxpanel with C++ Question: I am a C++ beginner and looking for a working example which embeds VTK output in wxpanel with C++ language. I came across the following https://sourceforge.net/projects/wxvtk/ which was last updated four years ago, and doesn’t compile with the latest cmake, VTK and WxWidgets. I am using MinGW-W64 …

Total answers: 2

wxPython check if the c++ part is deleted

wxPython check if the c++ part is deleted Question: I am working on a project where a function is throwing a wx.pyDeadObject Error because of a delayed task. I’ve read that in wx you can check if the c++ object still exsists by running if self:, however this no longer works in wxPython 3.0.2. using …

Total answers: 2

Set colour to wx.listbox item

Set colour to wx.listbox item Question: Wxpython provides the following api to change wx.listbox items colour: wx.ListBox.SetItemBackgroundColour(self, item, c) and wx.ListBox.SetItemForegroundColour(self, item, c) For some reason this functions fail to do so in my linux and windows. Any one know why? note that wx.ListBox.SetOwnBackgroundColor works perfectly. Asked By: Jah || Source Answers: My guess is …

Total answers: 2

Hide the "Failed to load" message when loading an invalid image, wxpython

Hide the "Failed to load" message when loading an invalid image, wxpython Question: bmp = wx.Image(“C:UserDesktopcool.bmp”, wx.BITMAP_TYPE_ANY).ConvertToBitmap() If i run this, it will automatically show an error message saying that it failed to load the image. How can I stop my program from doing this? Asked By: thelost || Source Answers: If all you’re after …

Total answers: 4

Qt being now released under LGPL, would you recommend it over wxWidgets?

Qt being now released under LGPL, would you recommend it over wxWidgets? Question: I am quite a heavy user of wxWidgets, partly because of licensing reasons. How do you see the future of wxWidgets in prospect of the recent announcement of Qt now being released under LGPL? Do you think wxwidget is still a good …

Total answers: 7