So far I have this as the contents of scripts I've named messages.rpy:
Code: Select all
init python:
#Message classes
class Message:
def __init__(self, subject, sender, body):
self.subject = subject
self.sender = sender
self.body = body
class Inbox:
def __init__(self):
self.messages = []
def send(self, message):
self.messages.append(message)
return True
def has_message(self, message):
if message in self.messages:
return True
else:
return False
#Variable declaration
inbox = Inbox()
messages = Inbox
#The messages themselves
welcome1 = Message("Welcome to the message system!", "Eileen", "Welcome to the message system! This is where you can send and receive messages from others.")
welcome2 = Message("Using the message system", "Eileen", "Using the message system is a snap! Simply select the message you want to read in your inbox with a click and it opens! But you knew that already, didn't you?")
What I'd like to know is how I'd go about listing the subjects all the messages in inbox.messages, and placing each entry within its own ui.textbutton which I can use to call up a new frame containing the message in full. Basically, making an actual inbox.
I'm brand new to python, so attempts to hack together a function for reading from inbox.message and displaying the list aren't going so well. I figured I should stop guessing and ask for a bit of help!