Parliament Diagram

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
User avatar
Andredron
Miko-Class Veteran
Posts: 700
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Parliament Diagram

#1 Post by Andredron »

https://github.com/Gouvernathor/renpy-ParliamentDiagram

A tool based upon https://github.com/slashme/parliamentdiagram, to create parliament diagrams showing the distribution of seats among the forces in presence, also called "election apportionment diagrams" on Wikimedia. This creates renpy Displayables to show such diagrams in renpy.

Howto
There are two styles of diagrams, Newarch ones are like an hemicycle, while the Westminster ones arrange seats in rows like in the british or australian parliaments.

Newarch
newarch(the_list, bg=None, **kwargs)

the_list takes a list containing a sublist for each party having seats. Each sublist must contain (in that order) a number of seats and a color. Other elements in that sublist will be ignored.

bg can take a color, which will fill the background of the chart.

Other keyword arguments will be passed to the Displayable constructor.

Warning ! Be careful to use the newarch function and not directly the Newarch displayable.

As this displays circles, some measure of anti-aliasing is necessary to render it as smooth as it deserves. That's why the Newarch displayable is rendered bigger than required, and then zoomed down to fit the requested size. The anti-aliasing factor can be found as the aafactor attribute of the Newarch class. 1 will do nothing, 2 will render it twice as wide and high as it finally needs.

Example :

screen test:
add newarch([(3, '#f00'), (23, '#090'), (24, '#009')])
Attachments
DiagramState-main.zip
(98.45 KiB) Downloaded 18 times
newarch-example.png
Last edited by Andredron on Wed Mar 15, 2023 10:35 am, edited 1 time in total.

User avatar
Andredron
Miko-Class Veteran
Posts: 700
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Re: Parliament Diagram

#2 Post by Andredron »



Drawing pie charts on the Ren'Py engine. For all sorts of RPGs and stuff.

code - https://github.com/NyashniyVladya/DiagramState

Renpy 7.3 and below versions - viewtopic.php?f=51&t=26541
Attachments
DiagramState-main.zip
(98.45 KiB) Downloaded 21 times

User avatar
HeartsIntoMinds
Newbie
Posts: 7
Joined: Sun Mar 19, 2023 8:30 am
itch: heartsintominds
Contact:

Re: Parliament Diagram

#3 Post by HeartsIntoMinds »

Neat stuff! The parliament diagram especially has me thinking about the possibility of a political drama VN where your choices impact how well your party does haha.

Post Reply

Who is online

Users browsing this forum: No registered users