我想知道当我在 IDLE 之外运行它时,如何在窗口中而不是 CMD 中获取我的代码。我将此代码与使用 tkinter 的菜单一起使用。提前致谢。另外,如果您知道如何缩短此代码,请告诉我。谢谢!
def Castle ():
import random
repeat = "True"
RSN = random.randint(1, 6);
while (repeat == "True"):
print("\nCastle:")
print("\nThe Random Season Chosen is Season", RSN)
if RSN == 1:
print("and The Random Episode Chosen is Episode", random.randint(1, 10))
elif RSN == 2:
print("and The Random Episode Chosen is Episode", random.randint(1, 24))
elif RSN == 3:
print("and The Random Episode Chosen is Episode", random.randint(1, 24))
elif RSN == 4:
print("and The Random Episode Chosen is Episode", random.randint(1, 23))
elif RSN == 5:
print("and The Random Episode Chosen is Episode", random.randint(1, 24))
elif RSN == 6:
print("and The Random Episode Chosen is Episode", random.randint(1, 23))
RSN = random.randint(1, 6);
repeat = input ("\nDo You Want To Run Again?: ")
Castle ();
No = print ("\nPress Enter To Exit")