oTree Forum >

Is it possible for a chosen picture to be displayed as a profile picture to other players?

#1 by rionny (edited )

I was wondering if participants were to choose from a selection of pictures (simple pixel art profile pictures), that this picture could be displayed to the other players in the group as a pseudo profile picture at the top of the relevant pages? I'm unsure if this is even possible as i can't find any experiment that does anything similar. 

Setting up the first part of choosing the pictures is easy enough, but I can't figure out how to display this selected picture to others.

Thanks in advance

#2 by rionny

Oh, I think if you get them to choose a picture by choosing a button and then use an if command to display it for others it might work, but i'm unsure if you can use if commands regarding other players actions. I'll have a look.

#3 by Fanist

In my understanding, "displaying the profile picture" is equal to showing a player-selected picture? If so, I think the implementation would be easy. 

Let's say we have 3 pictures to pick:
figures = ['1.jpg', '1.jpg', '1.jpg']

Then you add a page 'select-figure' to let everyone choose a picture just like @rionny said. Then you know the data player.figure_name. 

For the next page "show-figures", for each player, if you wanna show the profiles chosen by other players, you should use group.get_players(). The function will output a list of all players at the group, and you get each player's name and their chosen file name, and display them.

Write a reply

Set forum username