Good days, everyone.
I want to open the folder where game is installed with a button action(click action).
I've searched for a solution for hours, but I can't find any information anywhere.
Renpy might not have the ability to open a folder with button click. I asking you experts.
It would be very helpful if you knew the command to open a folder with button action.
I would be disappointed if Renpy didn't have that feature, but...
Any help or advice would be appreciated.
action OpenURL("http://www.yahoo.com")
This is a command statement to open HTML. I thought a command to open a folder would be similar to this.
Please help!!!
Can I open folder where the game is installed with a button action?
Forum rules
Questions about Ren'Py should go in the Ren'Py Questions and Announcements forum.
Questions about Ren'Py should go in the Ren'Py Questions and Announcements forum.
- Donmai
- Eileen-Class Veteran
- Posts: 1963
- Joined: Sun Jun 10, 2012 1:45 am
- Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
- Projects: Slumberland
- Location: Brazil
- Contact:
Re: Can I open folder where the game is installed with a button action?
Hi yoyuchi. It looks like your question is related to Ren'Py scripting. You will have a better chance of getting an answer if you ask in this forum section:
viewforum.php?f=8&sid=665874bcbffc6868be17e6fd95557867
viewforum.php?f=8&sid=665874bcbffc6868be17e6fd95557867
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)
TOIRE NO HANAKO (A Story About Fear)
Re: Can I open folder where the game is installed with a button action?
Opening a folder directly from a button action in Ren'Py can be a bit tricky since Ren'Py is mainly focused on visual novels and doesn't have built-in functions for file manipulation like opening folders.
One workaround could be to use the os module in Python, which Ren'Py is based on. You could write a Python function to open the folder using os.startfile and then call that function from your Ren'Py button action.
One workaround could be to use the os module in Python, which Ren'Py is based on. You could write a Python function to open the folder using os.startfile and then call that function from your Ren'Py button action.
-
- Regular
- Posts: 176
- Joined: Sat May 04, 2024 10:40 pm
- Contact:
Re: Can I open folder where the game is installed with a button action?
Os.startfile must be worked on windows only some other examples: import webbrowser, os
path="C:/Users"
webbrowser.open(os.path.realpath(path))
or with os alone
import os
os.system(f'start {os.path.realpath(path)}')
or subprocess
import subprocess,os
subprocess.Popen(f'explorer {os.path.realpath(path)}')
or
subprocess.run(['explorer', os.path.realpath(path)]) try each of this in function example init python: def openfolder(): import os
os.system(f'start {os.path.realpath(path)}') and in imagebutton action Function(openfolder()) try them. Ill try later
path="C:/Users"
webbrowser.open(os.path.realpath(path))
or with os alone
import os
os.system(f'start {os.path.realpath(path)}')
or subprocess
import subprocess,os
subprocess.Popen(f'explorer {os.path.realpath(path)}')
or
subprocess.run(['explorer', os.path.realpath(path)]) try each of this in function example init python: def openfolder(): import os
os.system(f'start {os.path.realpath(path)}') and in imagebutton action Function(openfolder()) try them. Ill try later
Re: Can I open folder where the game is installed with a button action?
Thanks for the detailed examples! I appreciate you breaking down the different ways to open a folder using Python's os module, webbrowser module, and subprocess module. It's great to have multiple options to try out.
I'll definitely give these a shot and see which one works best for my needs. The os.system approach seems like a simple and straightforward solution, but it's good to know that there are other alternatives available.
I'll definitely give these a shot and see which one works best for my needs. The os.system approach seems like a simple and straightforward solution, but it's good to know that there are other alternatives available.
-
- Regular
- Posts: 176
- Joined: Sat May 04, 2024 10:40 pm
- Contact:
Re: Can I open folder where the game is installed with a button action?
I remembered. Renpy allready have OpenDirectory for open any project game base images audio gui folders.i am using it to open renpy folder as its on another desktop. Im using action OpenDirectory(os.path.join(config.basedir, "."), absolute=True) itryed on imagebutton in test project .it works buut opens that test project game folder. You must change path what you want to open.
![Image](https://ibb.co/nR7r2z9)
https://ibb.co/nR7r2z9
https://ibb.co/nR7r2z9
Who is online
Users browsing this forum: No registered users