'Close me' button

On line 86 change the call to read MyMiniframe(None, "…

···

-----Original Message-----

From: dryhay

Sent: 14 Jun 2012 05:57:14 GMT

To: wxpython-users@googlegroups.com

Subject: Re: [wxPython-users] Re: ‘Close me’ button

One issue that you might have missed is that IDLE and wx don’t always play nicely together so try running your code from the command prompt - your problem above looks to be that you are not supplying a title for your new mini-Frame.

That has been checked as well with different combinations:

TypeError: init() got multiple values for keyword argument ‘title’

Target - problem visualized:
http://pasteall.org/pic/show.php?id=33111

and this is my script: http://codepad.org/4V1DVcTO

dryhay

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

Oh, sorry - that wasn’t my current script. I’ve checked on this script in the last link I’ve send you all your hints and tips anyone gave me, so that script is different than my current script, so I’ll leave it below again updated.

Target - problem visualized: http://pasteall.org/pic/show.php?id=33111
and my CURRENT script: http://codepad.org/mVPeCrxr

sry, thx

dryhay

So, if this is what a MyMiniFrame needs (from your current script):

wx.MiniFrame.__init__(self, parent, -1, title, pos, size, style)

then you need to give it those arguments in that order (here I make
its parent be None, which is acceptable for a frame or mini frame, I
believe), like this, which should all be on one line (keep in mind,
you never pass in self...that is automatic in Python):

var_MyMiniFrame = MyMiniFrame(None, -1, 'My Mini Frame',
wx.Point(0,0), wx.Size(200,200), 0)

···

On Thu, Jun 14, 2012 at 6:30 AM, dryhay <dryhay@gmail.com> wrote:

Oh, sorry - that wasn't my current script. I've checked on this script in
the last link I've send you all your hints and tips anyone gave me, so that
script is different than my current script, so I'll leave it below again
updated.

Target - problem visualized: http://pasteall.org/pic/show.php?id=33111
and my CURRENT script: http://codepad.org/mVPeCrxr

So, if this is what a MyMiniFrame needs (from your current script):

wx.MiniFrame.__init__(self, parent, -1, title, pos, size, style)

then you need to give it those arguments in that order (here I make
its parent be None, which is acceptable for a frame or mini frame, I
believe), like this, which should all be on one line (keep in mind,
you never pass in self...that is automatic in Python):

var_MyMiniFrame = MyMiniFrame(None, -1, 'My Mini Frame',
wx.Point(0,0), wx.Size(200,200), 0)

Scratch that...I took the line from wx.MiniFrame and NOT your subclass
of it, called MyMiniFrame... yours subclass needs these in this order:

(self, parent, title, pos=wx.DefaultPosition, size=wx.DefaultSize,
style=wx.DEFAULT_FRAME_STYLE)

So the line above should be, I think:

var_MyMiniFrame = MyMiniFrame(None, 'My Mini Frame', wx.Point(0,0),
wx.Size(200,200), 0)

So the line above should be, I think:

var_MyMiniFrame = MyMiniFrame(None, ‘My Mini Frame’, wx.Point(0,0),
wx.Size(200,200), 0)

This answer above is completely freezing my IDLE leaving message like the one below:

Attribute Error: ‘NoneType’ object has no attribute ‘Bind’

A little change [-1] is not freezing IDLE, but still returns a different error, like this one below:

Traceback (most recent call last):
File “/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/_misc.py”, line 1357, in Notify
self.notify()
File “/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/_core.py”, line 14738, in Notify
self.result = self.callable(*self.args, **self.kwargs)
File “/home/dry/Dokumenty/pyt/37.py”, line 75, in showFrame
var_MyMiniFrame=MyMiniFrame(None, -1, ‘My Mini Frame’, wx.Point(0,0), wx.Size(200,200), 0)
TypeError: init() takes at most 6 arguments (7 given)

Target - problem visualized: http://pasteall.org/pic/show.php?id=33111
and my currnet script: http://codepad.org/8HxsLUkn

dryhay

Hi,

So the line above should be, I think:

var_MyMiniFrame = MyMiniFrame(None, 'My Mini Frame', wx.Point(0,0),
wx.Size(200,200), 0)

This answer above is completely freezing my IDLE leaving message like the
one below:

Attribute Error: 'NoneType' object has no attribute 'Bind'

A little change [-1] is not freezing IDLE, but still returns a different
error, like this one below:

Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/_misc.py",
line 1357, in Notify
self.notify()
File "/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/_core.py",
line 14738, in Notify
self.result = self.callable(*self.args, **self.kwargs)
File "/home/dry/Dokumenty/pyt/37.py", line 75, in showFrame
var_MyMiniFrame=MyMiniFrame(None, -1, 'My Mini Frame', wx.Point(0,0),
wx.Size(200,200), 0)
TypeError: __init__() takes at most 6 arguments (7 given)

^ The error says your passing too many variables

Your class Def

"""
class MyMiniFrame(wx.MiniFrame):
    print 3

    def __init__(self, parent, title, pos=wx.DefaultPosition,
size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE):
        # parent.y='two'
        wx.MiniFrame.__init__(self, parent, -1, title, pos, size, style)
"""

The error as per the exception on Line 75:

"""
var_MyMiniFrame=MyMiniFrame(None, -1, 'My Mini Frame', wx.Point(0,0),
wx.Size(200,200), 0)
"""

Your class takes 5 parameters plus the implice 'self' param, when you
create it on line 75 you are passing 6 parameters plus the implicit
'self' so 7 > 6 just as the exception states.

Your definition is PARENT, TITLE, POS, SIZE, STYLE, your passing
PARENT, ID, TITLE, POS, SIZE, STYLE. For you usage you only really
need to pass the PARENT and TITLE.

"""
var_MyMiniFrame=MyMiniFrame(None, 'My Mini Frame')
"""

Cody

···

On Thu, Jun 14, 2012 at 10:13 AM, dryhay <dryhay@gmail.com> wrote:

Your problems all seem to be related to not understanding Python and how to create and use classes. You should backtrack a little and read this: The Python Tutorial — Python 3.13.0 documentation and maybe this: http://www.greenteapress.com/thinkpython/. After you learn how to walk you can then learn how to run by reading some wxPython tutorials, like this: wxPython tutorial - Python GUI programming in wxPython

···

On 6/14/12 8:13 AM, dryhay wrote:

    So the line above should be, I think:

    var_MyMiniFrame = MyMiniFrame(None, 'My Mini Frame', wx.Point(0,0),
    wx.Size(200,200), 0)

This answer above is completely freezing my IDLE leaving message like
the one below:

    Attribute Error: 'NoneType' object has no attribute 'Bind'

A little change [-1] is not freezing IDLE, but still returns a different
error, like this one below:

    Traceback (most recent call last):
    File
    "/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/_misc.py",
    line 1357, in Notify
    self.notify()
    File
    "/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/_core.py",
    line 14738, in Notify
    self.result = self.callable(*self.args, **self.kwargs)
    File "/home/dry/Dokumenty/pyt/37.py", line 75, in showFrame
    var_MyMiniFrame=MyMiniFrame(None, -1, 'My Mini Frame',
    wx.Point(0,0), wx.Size(200,200), 0)
    TypeError: __init__() takes at most 6 arguments (7 given)

Target - problem visualized: http://pasteall.org/pic/show.php?id=33111
<http://pasteall.org/pic/show.php?id=33111&gt;
and my currnet script: http://codepad.org/8HxsLUkn

--
Robin Dunn
Software Craftsman

“”"

var_MyMiniFrame=MyMiniFrame(None, ‘My Mini Frame’)

“”"

Cody

I really wish it was the correct solution, but unfortunately I can’t leave this line like you suggest me, because it is freezing my IDLE like nothing else before (checked 5 times), returning an Error:
Attribute Error: ‘NoneType’ object has no attribute ‘Bind’

Full error msg:

Traceback (most recent call last):

File “/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/_misc.py”,
line 1357, in Notify

self.notify()

File “/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/_core.py”,
line 14738, in Notify

self.result = self.callable(*self.args, **self.kwargs)

File “/home/dry/Dokumenty/pyt/37.py”, line 76, in showFrame

 var_MyMiniFrame=MyMiniFrame(None, 'My Mini Frame')

Attribute Error: ‘NoneType’ object has no attribute ‘Bind’

And same line, as you suggest, with id [-1] introduced there, is not freezing IDLE, but still returns a different error:
TypeError: String or Unicode type required

dryhay

Your problems all seem to be related to not understanding Python and how
to create and use classes. You should backtrack a little and read this:
http://docs.python.org/tutorial/ and maybe this:
http://www.greenteapress.com/thinkpython/. After you learn how to walk
you can then learn how to run by reading some wxPython tutorials, like
this: http://www.zetcode.com/wxpython/

That’s why I create this script - to learn something. Unfortunately I have a problem with this one step there which I am showing you. I’m trying to find the correct solution (but never reached) and I don’t know where else I could go with this problem. If I’ll see the correct solution to my problem I will learn what failed to work there.

Target - problem visualized: http://pasteall.org/pic/show.php?id=33111
and my currnet script: http://codepad.org/2wwcK8R9

dryhay

Hi,

"""
var_MyMiniFrame=MyMiniFrame(None, 'My Mini Frame')
"""

Cody

I really wish it was the correct solution, but unfortunately I can't leave
this line like you suggest me, because it is freezing my IDLE like nothing
else before (checked 5 times), returning an Error:

Attribute Error: 'NoneType' object has no attribute 'Bind'

Did you read the error and look where it happens the exception will
almost always tell you the exact error and exactly where it is
happening?

Your calling 'parent.Bind' where your passing None as the the Parent
so your getting the error above. As your class is now it requires a
valid parent window object and not a Null pointer (None).

Need to work in a cycle like any learning process

1) Have problem
2) Apply critical thinking to solve problem
3) Test solution
4a) If new problem Repeat starting at step 2
4b) else Done

And same line, as you suggest, with id [-1] introduced there, is not
freezing IDLE, but still returns a different error:

TypeError: String or Unicode type required

Again see above, read the exception, see the line where the error is,
and then locate why your passing the wrong type.

Also attached a sample to look at that can be modified to do the
actions your looking at in two different ways.

Cody

testDialog.py (1.2 KB)

···

On Thu, Jun 14, 2012 at 11:25 AM, dryhay <dryhay@gmail.com> wrote:

That was what I really need.
Thank you

dryhay