[Pygame] button

[Pygame] button

Postby metulburr » Mon Apr 21, 2014 12:48 pm

I think this question can only be answered by mekire, unless someone wants to jump into his class and mine quite deep.

the error i get is:
Code: Select all
metulburr@arch ~/repos/boom $ python game.py
difficulty: medium
window size: [800, 600]
Traceback (most recent call last):
  File "game.py", line 37, in <module>
    main(args['fullscreen'], difficulty, size)
  File "/home/metulburr/repos/boom/data/main.py", line 7, in main
    app.run()
  File "/home/metulburr/repos/boom/data/control.py", line 57, in run
    self.event_loop()
  File "/home/metulburr/repos/boom/data/control.py", line 41, in event_loop
    self.state.get_event(event, self.keys)
  File "/home/metulburr/repos/boom/data/states/viewer.py", line 79, in get_event
    self.next_button.check_event(event)
  File "/home/metulburr/repos/boom/data/GUI/button.py", line 52, in check_event
    self.on_release(event)
  File "/home/metulburr/repos/boom/data/GUI/button.py", line 62, in on_release
    self.function()
TypeError: 'NoneType' object is not callable
metulburr@arch ~/repos/boom  $


although i have no idea why button.function would be None as i send in a method here
New Users, Read This
OS Ubuntu 14.04, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
steam
User avatar
metulburr
 
Posts: 1415
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Re: [Pygame] button

Postby metulburr » Mon Apr 21, 2014 1:01 pm

nevermind, im an idiot. Forgot to throw a lambda in there.
https://github.com/metulburr/Boom/commi ... 81987a4e2e
New Users, Read This
OS Ubuntu 14.04, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
steam
User avatar
metulburr
 
Posts: 1415
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Re: [Pygame] button

Postby Yoriz » Mon Apr 21, 2014 1:02 pm

Looks like when you define a button you are passing it switch_card as it function which returns nothing.
New Users, Read This
Join the #python-forum IRC channel on irc.freenode.net!
Spam topic disapproval technician
Windows7, Python 2.7.4., WxPython 2.9.5.0., some Python 3.3
User avatar
Yoriz
 
Posts: 782
Joined: Fri Feb 08, 2013 1:35 am
Location: UK

Re: [Pygame] button

Postby metulburr » Mon Apr 21, 2014 1:07 pm

I seem to always figure it out like minutes after i post the question, however before posting the question, i was stuck for like an hour on this. :roll:
New Users, Read This
OS Ubuntu 14.04, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
steam
User avatar
metulburr
 
Posts: 1415
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Re: [Pygame] button

Postby Yoriz » Mon Apr 21, 2014 1:13 pm

If you solve it yourself minutes after posting the question, post the question sooner and you'll solve it quicker ;) .
New Users, Read This
Join the #python-forum IRC channel on irc.freenode.net!
Spam topic disapproval technician
Windows7, Python 2.7.4., WxPython 2.9.5.0., some Python 3.3
User avatar
Yoriz
 
Posts: 782
Joined: Fri Feb 08, 2013 1:35 am
Location: UK

Re: [Pygame] button

Postby metulburr » Mon Apr 21, 2014 1:25 pm

If you solve it yourself minutes after posting the question, post the question sooner and you'll solve it quicker

lmao. I know rihgt.....i can foresee a bunch of posts self answered.
New Users, Read This
OS Ubuntu 14.04, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
steam
User avatar
metulburr
 
Posts: 1415
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY


Return to Game Development

Who is online

Users browsing this forum: No registered users and 3 guests