1:40 PM (1 hour ago)
I am trying to show a SimpleNameValueDialog in response to a button click but unfortunately it’s giving me the error message below:
Traceback (most recent call last):
File “testingCode.py”, line 68, in ShowMessage5
style=wx.DEFAULT_DIALOG_STYLE, fields=data)
File “D:\Anaconda3\lib\site-packages\wx\lib\nvdlg.py”, line 53, in init
self.createFields(fields)
File “D:\Anaconda3\lib\site-packages\wx\lib\nvdlg.py”, line 71, in createFields
self.destroyFields()
File “D:\Anaconda3\lib\site-packages\wx\lib\nvdlg.py”, line 87, in destroyFields
for name, widgets in self._fields.iteritems():
AttributeError: ‘dict’ object has no attribute ‘iteritems’
and this is the code responsible for creating the dialog
data = [("user", "Username", None), ("pass", "Password", None)] dial = nvdlg.SimpleNameValueDialog(self, wx.ID_ANY, 'Login Window', style=wx.DEFAULT_DIALOG_STYLE, fields=data) dial.ShowModal()
i don’t get where is the error as i am following the guidelines for the fields as written in the documentation
A simple dialog that can prompt for values for any arbitrary set of name/value pairs, where the fields are defined by a list of info passed to the constructor. A dictionary of initial values can also be passed. Each item in the fields list is a tuple of 3 items, which are:
- a string to be used for the attribute name for storing the value
- a string to be used for the label
- None, or a dictionary of kwargs to be passed to the wx.TextCtrl ctor