目标是将以下代码减少为尽可能少的代码行数(尽可能少)。它不需要'可读',甚至'pythonic',只需简短而甜蜜。这些更有趣。将以下几行PhotoImage代码减少为尽可能少的行数
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")
它vaugly适用于我的计划,但我更因此只是想看看你们能想出!大家复活节快乐!
t =('蓝'等),因为我在t:会给你买几个字。 – Benjamin 2011-04-23 12:39:22