Skip to content

wxWidgets version?? #52

@tester0077

Description

@tester0077

Just purchased the book and am working my way through the examples.
In chapter 2, with the image viewer, I have run into one problem and one warning.
FWIW, I am new to wxPython & Python, but not wxWidgets and my goal - partially achieved already - is to use wxFormBuilder as a front-end for designing the GUI itself.

In order to sort out the problems I am running into, I am now running the file image_viewer_working.py from the github repo in the current Visual Stdio Code 1.64.0 (user setup) - running Win 10-64-bit
The problem message when running the code:
_PS D:\pkg\python\wxFB\wxPython\ImageViewer> d:; cd 'd:\pkg\python\wxFB\wxPython\ImageViewer'; & 'C:\Users\arnold\AppData\Local\Programs\PythonCodingPack\python.exe' 'c:\Users\arnold.vscode\extensions\ms-python.python-2022.0.1786462952\pythonFiles\lib\python\debugpy\launcher' '59120' '--' 'd:\pkg\python\wxPython\applications_with_wxpython-master\chapter2_image_viewer\image_viewer_working.py'
Traceback (most recent call last):
File "d:\pkg\python\wxPython\applications_with_wxpython-master\chapter2_image_viewer\image_viewer_working.py", line 43, in on_browse
self.photo_txt.SetValue(dialog.GetPath())
wx.core.wxAssertionError: C++ assertion ""!HasFlag(wxFD_MULTIPLE)"" failed at C:\PROJECTS\bb2\dist-win64-py38\build\ext\wxWidgets\include\wx/filedlg.h(109) in
wxFileDialogBase::GetPath(): When using wxFD_MULTIPLE, must call GetPaths() instead

and the image is never displayed because of this exception.
replacing line 40 : style=wx.ID_OPEN) as dialog:
with : style=wx.FD_OPEN) as dialog:

gives me the warning
d:; cd 'd:\pkg\python\wxFB\wxPython\ImageViewer'; & 'C:\Users\arnold\AppData\Local\Programs\PythonCodingPack\python.exe' 'c:\Users\arnold.vscode\extensions\ms-python.python-2022.0.1786462952\pythonFiles\lib\python\debugpy\launcher' '59190' '--' 'd:\pkg\python\wxPython\applications_with_wxpython-master\chapter2_image_viewer\image_viewer_working.py'
d:\pkg\python\wxPython\applications_with_wxpython-master\chapter2_image_viewer\image_viewer_working.py:62: DeprecationWarning: an integer is required (got type
float). Implicit conversion to integers using int is deprecated, and may be removed in a future version of Python.
img = img.Scale(NewW,NewH)

though the image is displayed as I would expect, though, at this stage I am unsure about what to expect.

Questions:

  1. is there a way to easily tell which version of wxPython is being used, version which version(s) might be installed?
  2. is there a way to easily tell which version of wxWidgets wxPython is using? Again, as opposed to which version(s) of wsWidgets might be installed on the PC

The first problem is seemingly caused by a mismatch of the wxWidgets versions expected by your code and what is installed on my system - the PC I am running this one has ONLY wxWidgets 3.1.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions