1

Hey I Am Getting the error while processing this python code . Please Note that i am new to python . Thanks

Here is the code

import wx

class harry(wx.Frame):
    def __init__(self,parent,id):
        wx.Frame.__init__(self,parent,id,'Frame aka Window', size=(300,200))
        panel=wx.Panel(self)

        box = wx.TestEntryDialog(None ,"Whats ur Name ?" ,"Title","default text")
        if box.showModal()==wx.Id_OK:
            answer=box.getValue()

if __name__=='__main__':
    app = wx.App(False)
    frame = harry(parent=None,id=-1)
    frame.Show()
    app.MainLoop()

The error i get is

 Traceback (most recent call last):
 File "C:\pybuck\pytuts9.py", line 14, in <module>
 frame = harry(parent=None,id=-1)
 File "C:\pybuck\pytuts9.py", line 8, in __init__
 box = wx.TestEntryDialog(None ,"Whats ur Name ?" ,"Title","default text")
 AttributeError: 'module' object has no attribute 'TestEntryDialog'

My Motive Is to input the user to write its input ( like name ) in the window aka frame thats pops up ! Thanks , Harry

2
  • my computer is 64 bit but i downloaded 32 bit python ( 2.7) idle by mistake so to cope with that i am using wxpython with 32 bit ! is that the problem bro Commented Sep 18, 2014 at 11:24
  • No, the real problem is the one @nepix32 told you. You are mistaking Test for Text. I neither realize it when reading Commented Sep 18, 2014 at 13:01

1 Answer 1

3

Maybe you are searching for wx.TextEntryDialog (as far as I know there is no wx.TestEntryDialog?

Edit: The Name of things in Python is case-sensitive! AttributeError is a nice way of python telling you: "Hey dude, what you searching for, does not exist!". You have the following possibilities to search for things which you think are there, but are not.

All three will tell you to use ShowModal instead of showModal.

Sign up to request clarification or add additional context in comments.

5 Comments

I Watched this tuts from here --> youtu.be/5SJO9dk9uOQ and wx.TextEntryDialog is working there fine in the tutorial. as far i think that is not the problem . though i can't full guarantee as i am new to python
@Harry you are not using TextEntryDialog but TestEntryDialog. Check your code
@joaquin thanks buddy for correcting silly mistake but the same error still occurs .... something else is the problem dude
@Harry edit you question with the correct wx method and the current error. Note that after correcting your mispelling you should not have the same error traceback
@nepix32 ... THANKS IT WORKED ! Your Edit of your post ! cheers

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.