Ren'Py How to add a menu bar in Ren'Py?

May 29, 2022
231
445
I know there's a way to do this in Python, using Tkinter. However, I think Tkinter uses C libraries so I feel like it's potentially not supported in Ren'Py. And I don't mean the navigation menu and stuff like that, I'm talking about something that looks like this:

menubar-windows.jpg

Except with "File, Save, Load, Language, System, About" and stuff like that.

A lot of popular visual novel engines (like KiriKiri and CatSystem2) have this, so I find it a bit insane that it's already not an option in Ren'Py. Is there a way to add this functionality to Ren'Py? Or is it just not possible at all? I've attempted to make multiple google searches on how to do so but it seems like there's no answer. Attempted to try with Tkinter, however it didn't really work for me and I'm afraid it may break the game.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,959
16,192
However, I think Tkinter uses C libraries so I feel like it's potentially not supported in Ren'Py.
The problem isn't the libraries used by TKinter, but the fact that it rely on TK, and therefore create its own window context ; a context that would obviously be totally independent of PyGame (and so Ren'Py) one.


A lot of popular visual novel engines (like KiriKiri and CatSystem2) have this, so I find it a bit insane that it's already not an option in Ren'Py.
What do you want exactly ? I mean, the quick menu is exactly what I thought you wanted before reaching this line.
It's not because it's put in the bottom of the screen, and styled in another way, that it's not a menu. Just change the screen named "quick_menu" and its still until you reach the visual you want.
 

Tompte

Member
Dec 22, 2017
216
157
Pardon me butting in. I don't know anything about Ren'py but I have done a lot of Windows programming.

That sort of menu bar is a long-standing component of Windows, the operating system. To create one, you'd need to natively talk to a Windows library (typically during window creation). This, naturally, breaks platform independence. It also assumes the player is using a mouse or keyboard. There are ways around this, of course, but it would involve more work and more code to maintain (for Ren'py) since they'd have to do the same across multiple operating systems.

Since Ren'py is meant to work on lots of platforms (including mobile), they would prefer to stay as platform-agnostic as possible. This is probably why Ren'py doesn't supply that sort of functionality out of the box (or at least I assume it doesn't. I did a quick search and nothing came up.)

I mean, they could do it, but the question comes down to "why?" It's arguably out of scope of what Ren'py is trying to achieve. It's probably something a different Python library could offer instead. Someone who actually uses Python might be able to correct me though.
 
Last edited:
May 29, 2022
231
445
Pardon me butting in. I don't have any experience with Ren'py but I have done a lot of Windows programming.

That sort of menu bar is a long-standing component of Windows, the operating system. To create one, you'd need to natively talk to a Windows library (typically during window creation). This, naturally, breaks platform independence. There are ways around this, but it would involve more work and more code to maintain (for Ren'py).

Since Ren'py is meant to work on lots of platforms (including mobile), they would prefer to avoid as many platform-specific features as possible. This is probably why Ren'py doesn't supply that sort of functionality out of the box (or at least I assume it doesn't. I did a quick search and nothing came up.)

I mean, they could do it, but the question comes down to "why?" It's arguably out of scope of what Ren'py is trying to achieve. It's probably something a different Python library could offer instead. Someone who actually knows Python might be able to correct me.
Everyone asks why. But it's always when it's almost not known or not known to be possible. I thought it would be a neat touch to a visual novel type game, and since a lot of visual novel engines have this functionality, I'd assume Ren'Py would have the same functionality too. To be fair, I am going to code the menu bar to only be available on PC devices (such as Windows and Linux and Mac devices) so it weirdly baffles me Ren'Py doesn't have this kind of feature. I don't mind having to insert any third-party functionality, I just wanted to know if it's possible, and how to do it.

What do you want exactly ? I mean, the quick menu is exactly what I thought you wanted before reaching this line.
It's not because it's put in the bottom of the screen, and styled in another way, that it's not a menu. Just change the screen named "quick_menu" and its still until you reach the visual you want.
Well, I guess you could technically change up the quick menu to look like a menu bar, but when I was referring to CatSystem2 and KiriKiri, I was referring to this kind of menu bar you commonly see in those type of games:

nekopara_menubar1.PNG = Nekopara's menu bar. To be fair, most KiriKiri games have a similar looking menu bar.

nekopara_menubar2.PNG = And the menu bar displaying while the quick menu is on the bottom right.

nekopara_menubar3.PNG = Will be able to be hidden without any awkward stretching!

(and to be fair, I wanted a menu bar so if lets say, if someone had their operating system in dark mode, the menu bar would change to the specific color that the operating system has, which would be a pain to recreate with Ren'Py, textbuttons and images)
 
  • Like
Reactions: Tompte

Tompte

Member
Dec 22, 2017
216
157
I don't discourage you from wanting a "real" menu bar. There are plenty of reasons to have one, including the one you mentioned. I was just throwing out an educated guess as to why it wouldn't be possible.
 
May 29, 2022
231
445
I don't discourage you from wanting a "real" menu bar. There are plenty of reasons to have one, including the one you mentioned. I was just throwing out an educated guess as to why it wouldn't be possible.
I don't mind, it's okay. To be fair, I was also thinking of potentially using Visual Studio to try and code a menu bar, but Ren'Py seems to be really finnicky when it comes to custom modules, because I think Ren'Py only really accepts pure-python modules, so if you wanted to use libraries that have snippets from other programming languages, then Ren'Py wouldn't really work that correctly, I'm guessing.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,959
16,192
There are ways around this, of course, but it would involve more work and more code to maintain (for Ren'py) since they'd have to do the same across multiple operating systems.
Not just more work, it would need that you get the main window widget stored in the depth of PyGame, itself stored in the depth of Ren'Py. And it's only then, and if the said main windows isn't stored on a protected attribute, that you can split the code to include the menu bar depending of the OS specificity.


(and to be fair, I wanted a menu bar so if lets say, if someone had their operating system in dark mode, the menu bar would change to the specific color that the operating system has, which would be a pain to recreate with Ren'Py, textbuttons and images)
I think that you haven't thought this long enough. You've the possibility to have a menu bar that will nicely bend into the whole game design, and you want to make it stand out like a pustule on a witch nose.
There's a reason why nowadays most software try to get ride off it. It take useless space, rarely looks good, and even less frequently justify all the space it occupy.


[...] I think Ren'Py only really accepts pure-python modules, so if you wanted to use libraries that have snippets from other programming languages, then Ren'Py wouldn't really work that correctly, I'm guessing.
Ren'Py accept any kind of Python libraries, including compiled libraries, and it even have it's own compiled library. What it don't accept is modules that either create their own window context (like TKinter), or need an access to the main window. The first one for obvious reason, the second one because I'm not even sure that you can get it from PyGame ; you more surely get the canvas PyGame built over it, than the main window from a system point of view.
 
May 29, 2022
231
445
Ren'Py accept any kind of Python libraries, including compiled libraries, and it even have it's own compiled library. What it don't accept is modules that either create their own window context (like TKinter), or need an access to the main window. The first one for obvious reason, the second one because I'm not even sure that you can get it from PyGame ; you more surely get the canvas PyGame built over it, than the main window from a system point of view.
Ah, that makes sense. I thought Ren'Py only accepted pure-python libraries! Thanks for telling me that