Imagebutton GUI Framework [GxImagebuttons]

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Message
Author
DoctorScaglietti
Newbie
Posts: 8
Joined: Tue Dec 31, 2013 10:36 pm
Projects: Heartbleed Wonderland
Location: Right behind you
Contact:

Re: Imagebutton GUI Framework [GxImagebuttons]

#46 Post by DoctorScaglietti »

Works fine now! Still want to know how to change zoom, though. I'd like to use it for a point-and-click environment, and some images will be different sizes depending on their relative distance from the viewer (simulated through zoom). This will change from screen to screen, so doing all of them through my graphics editor is not an option.

Is there any way to utilize zoom for this? I doesn't seem to accept it as a parameter.

User avatar
leon
Miko-Class Veteran
Posts: 554
Joined: Sun Oct 09, 2011 11:15 pm
Completed: Visual Novel Tycoon, Night at the Hospital, Time Labyrinth, The Buried Moon, Left of Center, Super Otome Quest
Projects: Lemon Project, Porcelain Heart, Dream's Dénouement
Organization: Team ANARKY
Contact:

Re: Imagebutton GUI Framework [GxImagebuttons]

#47 Post by leon »

Since this is a general Ren'Py question, not related to this framework, I suggest you ask at Ren'Py Questions and Announcements. Don't forget to include all the relevant lines of your code.

User avatar
dyrarendy
Regular
Posts: 59
Joined: Wed Apr 02, 2014 12:26 pm
Projects: Visual Novel Dating Sims Masa SMA
Location: Indonesia, Cimahi
Contact:

Re: Imagebutton GUI Framework [GxImagebuttons]

#48 Post by dyrarendy »

Leon, thanks so much for this Thread.
My project is full of Imagebutton now. I never touching tried imageMaps.
Even my Project is using my native language, u can seen the ATL i used into.
Take a look :
My Project :
Image

User avatar
Altsune
Newbie
Posts: 14
Joined: Tue Mar 25, 2014 10:57 pm
Completed: Let's go! Hiragana, Let's go! Katakana, Let's go! Hangul
Organization: Madame Motoko
Github: https://github.com/MadameMotoko
itch: Motoko
Location: Pittsburgh, PA
Contact:

Re: Imagebutton GUI Framework [GxImagebuttons]

#49 Post by Altsune »

Woah, this is pretty helpful! Thanks!

verysunshine
Veteran
Posts: 339
Joined: Wed Sep 24, 2014 5:03 pm
Organization: Wild Rose Interactive
Contact:

Re: Imagebutton GUI Framework [GxImagebuttons]

#50 Post by verysunshine »

I was panicking because I thought I couldn't open the file. Thanks for the plain text versions!

Build the basics first, then add all the fun bits.

Please check out my games on my itch.io page!

verysunshine
Veteran
Posts: 339
Joined: Wed Sep 24, 2014 5:03 pm
Organization: Wild Rose Interactive
Contact:

Re: Imagebutton GUI Framework [GxImagebuttons]

#51 Post by verysunshine »

I know this is just a tutorial, but I found a bug in the code. None of the sliders in the options menus have "hidden" settings.

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/screens.rpy", line 135, in <module>
    bar value Preference("music volume")
AttributeError: 'ScreenDisplayable' object has no attribute 'hiding'

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "renpy/common/_layout/screen_main_menu.rpym", line 29, in script
    $ ui.interact()
  File "/Applications/renpy-6.18.0-sdk/renpy/ast.py", line 778, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "/Applications/renpy-6.18.0-sdk/renpy/python.py", line 1382, in py_exec_bytecode
    exec bytecode in globals, locals
  File "renpy/common/_layout/screen_main_menu.rpym", line 29, in <module>
    $ ui.interact()
  File "/Applications/renpy-6.18.0-sdk/renpy/ui.py", line 247, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "/Applications/renpy-6.18.0-sdk/renpy/display/core.py", line 2145, in interact
    repeat, rv = self.interact_core(preloads=preloads, **kwargs)
  File "/Applications/renpy-6.18.0-sdk/renpy/display/core.py", line 2393, in interact_core
    root_widget.visit_all(lambda i : i.per_interact())
  File "/Applications/renpy-6.18.0-sdk/renpy/display/core.py", line 335, in visit_all
    d.visit_all(callback)
  File "/Applications/renpy-6.18.0-sdk/renpy/display/core.py", line 335, in visit_all
    d.visit_all(callback)
  File "/Applications/renpy-6.18.0-sdk/renpy/display/core.py", line 335, in visit_all
    d.visit_all(callback)
  File "/Applications/renpy-6.18.0-sdk/renpy/display/core.py", line 335, in visit_all
    d.visit_all(callback)
  File "/Applications/renpy-6.18.0-sdk/renpy/display/screen.py", line 380, in visit_all
    callback(self)
  File "/Applications/renpy-6.18.0-sdk/renpy/display/core.py", line 2393, in <lambda>
    root_widget.visit_all(lambda i : i.per_interact())
  File "/Applications/renpy-6.18.0-sdk/renpy/display/screen.py", line 392, in per_interact
    self.update()
  File "/Applications/renpy-6.18.0-sdk/renpy/display/screen.py", line 551, in update
    self.screen.function(**self.scope)
  File "/Applications/renpy-6.18.0-sdk/renpy/screenlang.py", line 1247, in __call__
    renpy.python.py_exec_bytecode(self.code.bytecode, locals=scope)
  File "/Applications/renpy-6.18.0-sdk/renpy/python.py", line 1382, in py_exec_bytecode
    exec bytecode in globals, locals
  File "game/screens.rpy", line 135, in <module>
    bar value Preference("music volume")
  File "/Applications/renpy-6.18.0-sdk/renpy/ui.py", line 446, in __call__
    if (renpy.display.focus.grab is w) and (not screen.hiding):
AttributeError: 'ScreenDisplayable' object has no attribute 'hiding'

Darwin-10.8.0-i386-64bit
Ren'Py 6.18.0.635
Renpy Imagebuttons GUI Sample 1.0

Build the basics first, then add all the fun bits.

Please check out my games on my itch.io page!

User avatar
PyTom
Ren'Py Creator
Posts: 16088
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Imagebutton GUI Framework [GxImagebuttons]

#52 Post by PyTom »

That's a bug in 16.18.0. Upgrade to a newer version of Ren'Py to fix it.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

verysunshine
Veteran
Posts: 339
Joined: Wed Sep 24, 2014 5:03 pm
Organization: Wild Rose Interactive
Contact:

Re: Imagebutton GUI Framework [GxImagebuttons]

#53 Post by verysunshine »

Thank you, PyTom!

Build the basics first, then add all the fun bits.

Please check out my games on my itch.io page!

User avatar
Luxliev
Veteran
Posts: 242
Joined: Sat Feb 07, 2015 11:01 am
Soundcloud: Luxliev
Contact:

Re: Imagebutton GUI Framework [GxImagebuttons]

#54 Post by Luxliev »

That's amazing tutorial thanks to all that helped to make it. Great that you also added documentation links.
Animation of home/title screen button (one that spins) made me laugh out loud. I also like that lucy_proud.png has 4 brows.
Newest classical cover: Advance Wars - Sami Theme: https://www.youtube.com/watch?v=657Jt7hJRVc

Forum with my music: http://luxliev.proboards.com/

User avatar
TrailsInTheSky
Regular
Posts: 39
Joined: Thu May 22, 2014 10:27 am
Projects: I'm Not The Perfect Guy For Her
Contact:

Re: Imagebutton GUI Framework [GxImagebuttons]

#55 Post by TrailsInTheSky »

Thanks alot :)
Mystery creates wonder and wonder is the basis of man's desire to understand.
-Neil Armstrong

Current project: I'm Not The Perfect Guy For Her (Rom.Com.Drama)
https://www.facebook.com/trailsin.thesky.1
http://bestofthebestclassicalpianomusic.tumblr.com
http://blog-trailsinthesky.tumblr.com/

Ordagon
Newbie
Posts: 3
Joined: Sat May 02, 2015 1:29 pm
Contact:

Re: Imagebutton GUI Framework [GxImagebuttons]

#56 Post by Ordagon »

Hi, first of all THANK YOU. I think this tutorial is awesome. But somehow I can't replicate it in my game.
I am working in a game, and in certain part you play rock, paper, scissors. And of course I used an image map to make it look good. Then I heard about using image buttons and I fell in love with the idea. I will describe the process I go through(more or less)

1º I create the png's and call them rock_idle.png and rock_hover.png and place them in the gui folder
2º I add the code in screens.rpy
screen rpsmenu:
imagebutton auto "gui/rock_%s.png" xpos 712 ypos 414 focus_mask True action Return("rock")
3º save it
4º I write the code show rpsmenu in the part of the script.rpy where I need the game to appear
5º save it
6º then i run the game and what I get is a grey silhoute with the text rpsmenu

I think I am forgetting something, but don't know what. If you could tell me what I am doing wrong would be great.
Thanks in advance for your time. I am using version 6.99.3.404

User avatar
leon
Miko-Class Veteran
Posts: 554
Joined: Sun Oct 09, 2011 11:15 pm
Completed: Visual Novel Tycoon, Night at the Hospital, Time Labyrinth, The Buried Moon, Left of Center, Super Otome Quest
Projects: Lemon Project, Porcelain Heart, Dream's Dénouement
Organization: Team ANARKY
Contact:

Re: Imagebutton GUI Framework [GxImagebuttons]

#57 Post by leon »

I suggest you start a new thread at Ren'Py Questions and Announcements and include your game files.

User avatar
bloodyhair
Regular
Posts: 61
Joined: Tue Aug 11, 2015 7:20 am
Deviantart: Takada-Wang
Contact:

Re: Imagebutton GUI Framework [GxImagebuttons]

#58 Post by bloodyhair »

Thank you so much for the tutorial :3 ~ *bow to the epicness of imagebutton*

anyway, I am wondering if you make a BIG button by accident, is there any way to make it smaller by code?

User avatar
leon
Miko-Class Veteran
Posts: 554
Joined: Sun Oct 09, 2011 11:15 pm
Completed: Visual Novel Tycoon, Night at the Hospital, Time Labyrinth, The Buried Moon, Left of Center, Super Otome Quest
Projects: Lemon Project, Porcelain Heart, Dream's Dénouement
Organization: Team ANARKY
Contact:

Re: Imagebutton GUI Framework [GxImagebuttons]

#59 Post by leon »

It's best to resize it in your favorite image editor, but if you want to do it by code there's a few ways to do it - http://lemmasoft.renai.us/forums/viewto ... f=8&t=9185

User avatar
bloodyhair
Regular
Posts: 61
Joined: Tue Aug 11, 2015 7:20 am
Deviantart: Takada-Wang
Contact:

Re: Imagebutton GUI Framework [GxImagebuttons]

#60 Post by bloodyhair »

Yup it is solved. Thank you very much.

if you don't mind I want to ask a bit about main menu button in your tutorial.

Code: Select all

imagebutton auto "gui/main_start_%s.png" xpos 773 ypos y focus_mask True action Start() hovered [ Play ("test_one", "sfx/click.wav"), Show("gui_tooltip", my_picture="gui/tooltip_main_menu_start.png", my_tt_xpos=46, my_tt_ypos=518) ] unhovered [Hide("gui_tooltip")] at main_eff1
1. what is "test_one" ? Is that important? Is that only a name (string) or it is connected to data in game folder? If I want to change the sfx with my own, do I still need to add "test_one" or I can directly put "sounds_test.wav"?

2. what is main_eff1?

thank you very much

Post Reply

Who is online

Users browsing this forum: crowcinthus