renpy.show() questions

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.
Post Reply
Message
Author
halimgur
Newbie
Posts: 3
Joined: Sun May 24, 2015 11:41 pm
Contact:

renpy.show() questions

#1 Post by halimgur »

I am new to Ren'Py but I am interested in its use as a teaching aid for engineering students. I would like to have a PYTHON function to display its argument at the given position. This is my PYTHON function code that works

Code: Select all

def myshow(image_name,x,y):
    renpy.show(image_name)
I could not make it working when I tried to use th arguments x and y to position the image.

How do I use the second and third arguments "x" and "y" to position the image (the first argument).

Reading the documentation, I thought something like the following would work:

Code: Select all

def myshow(image_name,x,y):
    renpy.show(image_name, at_list=[x,y])
It does not. Can anyone help?

paktek123
Newbie
Posts: 13
Joined: Thu Jan 01, 2015 8:31 am
Completed: Raiser RPG Framework for Ren'Py
Github: paktek123
Contact:

Re: renpy.show() questions

#2 Post by paktek123 »

what are you passing as your 'x' and 'y'? These should be Position objects.

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: renpy.show() questions

#3 Post by xela »

Code: Select all

def my_show(image_name, x, y):
    renpy.show(image_name, at_list=[Transform(pos=(x, y))])
but there are at least 6 other ways it can be done. You'll prolly have to define images if you want to show them this way, you'll have to use Image/Transform/At if you load directly from path.
Like what we're doing? Support us at:
Image

halimgur
Newbie
Posts: 3
Joined: Sun May 24, 2015 11:41 pm
Contact:

Re: renpy.show() questions

#4 Post by halimgur »

xela wrote:

Code: Select all

def my_show(image_name, x, y):
    renpy.show(image_name, at_list=[Transform(pos=(x, y))])
but there are at least 6 other ways it can be done. You'll prolly have to define images if you want to show them this way, you'll have to use Image/Transform/At if you load directly from path.
Thanks for this but this did not work for me. PYTHON complains that "Transform" is not defined.

I only have two renpy import statements:

Code: Select all

import renpy.store as store
import renpy.exports as renpy
Should I import other renpy modules to get "Transform" recognised as a legit class by PYTHON? I could not find a place in the documentation where it says how renpy classes should be imported into PYTHON.

In answer to the question on what x and y are, I was calling this function as

Code: Select all

my_show(image_name, 400, 500)
I understand about pixel and relative positions, etc. I understand how the Position class works. I cannot get PYTHON recognise it (or any other RENPY variable or class name for that matter other than the ones I define).

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: renpy.show() questions

#5 Post by xela »

I tend not to use .py files... what are your reasons?

You can prolly access it through:

renpy.display.motion.Transform or store.Transform...
Like what we're doing? Support us at:
Image

halimgur
Newbie
Posts: 3
Joined: Sun May 24, 2015 11:41 pm
Contact:

Re: renpy.show() questions

#6 Post by halimgur »

xela wrote:I tend not to use .py files... what are your reasons?
Great question !! I do not know why.

I have just put it as a PYTHON function into an RPY file and the problem is solved.

So, the lesson is that one should use .py files only when one needs to do non-renpy things (like calculations, etc). Otherwise, I need to include python code in the RPY files so that the python code can access the RENPY names.

Thank you very much.

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: renpy.show() questions

#7 Post by xela »

There is no reason to use .py files at all. You can put all logic in .rpy files on

Code: Select all

python:
indent.
Like what we're doing? Support us at:
Image

Post Reply

Who is online

Users browsing this forum: No registered users