The goal is to reduce the following code to as few lines (and as few characters) of code as possible. It doesn’t need to be ‘readable’ or even ‘pythonic’, just short and sweet. this ones more for fun.
self.BlueEgg = PhotoImage(file="assets/blueegg.gif")
self.PolkaEgg = PhotoImage(file="assets/polkaegg.gif")
self.RedEgg = PhotoImage(file="assets/redegg.gif")
self.StripeEgg = PhotoImage(file="assets/sripeegg.gif")
self.YellowEgg = PhotoImage(file="assets/yellowegg.gif")
self.PurpleEgg = PhotoImage(file="assets/purpleegg.gif")
self.PinkEgg = PhotoImage(file="assets/pinkegg.gif")
self.OrangeEgg = PhotoImage(file="assets/orangeegg.gif")
self.CrazyEgg = PhotoImage(file="assets/crazyegg.gif")
self.PlainEgg = PhotoImage(file="assets/plainegg.gif")
It does vaugly apply to my program, but i more-so just wanted to see what you guys could come up with! happy easter everyone!
The only thing that changes is the type of egg, which changes the attribute on self and the filename. So…