import linecache import pygame from datetime import * from tkinter import * import os import random time = datetime.today() w = Tk() w.title("Million (Beta version v.0.1)") w.configure(bg="black") w.resizable(0 , 0) w.geometry("600x260") os.system("db23456789.txt") # هاي مال صوت :) def ps(): pygame.init() pygame.mixer.music.load("btn.mp3") #اسم ملف الصوت يجب ان يكون صيغة pygame.mixer.music.play() def sg(): os.system("db2.txt") pygame.init() pygame.mixer.music.load("btn.mp3") #اسم ملف الصوت يجب ان يكون صيغة pygame.mixer.music.play() o = open("db.txt", "r+") o.write("اسم الفريق الاول : " + " "+ "["+e1.get()+ "]\n") o.write("اسم الفريق الثاني : " + " "+ "["+e2.get()+ "]") o.close() def H(): pygame.init() pygame.mixer.music.load("btn.mp3") #اسم ملف الصوت يجب ان يكون صيغة pygame.mixer.music.play() with open ("An.txt", "r") as f: lines = f.readlines() rl1 = random.choice(lines) rl2 = random.choice(lines) rl3 = random.choice(lines) rl4 = random.choice(lines) w2.destroy() wh = Tk() wh.title("Million (Beta version v.0.1)") wh.configure(bg="black") wh.resizable(0 , 0) wh.geometry("1350x695") bt1 = Button(wh, text="1- "+rl1, font="family 25", bg="white") bt2 = Button(wh, text="2- "+rl2, font="family 25", bg="white") bt3 = Button(wh, text="3- "+rl3, font="family 25", bg="white") bt4 = Button(wh, text="4- "+rl4, font="family 25", bg="white") get = linecache.getline('db.txt',1) lbq = Label(wh, text=get, font="family 25", bg="black", fg="white") lbq.grid(sticky=N, pady=10, padx=450) bt1.grid(pady=10, padx=200, sticky=N) bt2.grid(pady=10, padx=200, sticky=N) bt3.grid(pady=10, padx=200, sticky=N) bt4.grid(pady=10, padx=200, sticky=N) def SI(): pygame.init() pygame.mixer.music.load("btn.mp3") #اسم ملف الصوت يجب ان يكون صيغة pygame.mixer.music.play() w2.configure(bg="red") def SP(): pygame.init() pygame.mixer.music.load("btn.mp3") #اسم ملف الصوت يجب ان يكون صيغة pygame.mixer.music.play() w2.configure(bg="blue") #DisAbled def B(): w2.configure(bg="white") def C(): w2.configure(bg="brown") def M(): w2.configure(bg="pink") w.after(4000) w.destroy() w2 = Tk() w2.title("Million (Beta version v.0.1)") w2.configure(bg="black") w2.resizable(0 , 0) w2.geometry("1350x695") B1 = Button(w2, text="التاريخ", height="1", width="80", command=H, font="Times 25") B2 = Button(w2, text="العلوم", height="1", width="80", command=SI, font="Times 25") B3 = Button(w2, text="الرياضة", height="1", width="80", command=SP, font="Times 25") B4 = Button(w2, text=" .. قريباٌ ", height="1", width="80", command=B, font="Times 25") B5 = Button(w2, text=" .. قريباٌ ", height="1", width="80", command=C, font="Times 25") B6 = Button(w2, text=" .. قريباٌ ", height="1", width="80", command=M, font="Times 25") B7 = Button(w2, text=" .. قريباٌ ", height="1", width="80", command=M, font="Times 25") L = Label(w2, text=": اختر المجال الذي تريد ان تُختبر به ", bg="black", fg="white", font="Times 25") L.grid(sticky=N, padx=0, pady=10) B1.grid(sticky=NW, padx=0, pady=5) B2.grid(sticky=NW, padx=0, pady=5) B3.grid(sticky=N, padx=0, pady=5) B4.grid(sticky=NW, padx=0, pady=5) B5.grid(sticky=N, padx=0, pady=5) B6.grid(sticky=N, padx=0, pady=5) B7.grid(sticky=N, padx=0, pady=5) # هاي مال صوت :) def ps(): pygame.init() pygame.mixer.music.load("btn.mp3") #اسم ملف الصوت يجب ان يكون صيغة pygame.mixer.music.play() FN = StringVar() SN = StringVar() e1 = Entry(w, textvariable=FN) e2 = Entry(w, textvariable=SN) l1 = Label(w, text=": اسم الفريق الاول ", bg="black", fg="white") l2 = Label(w, text=": اسم الفريق الثاني", bg="black", fg="white") def SN(): with open ('file2.txt') as file: for i in file: file.write("asdasdas") b2 = Button(w, text="! بدء اللعبة ", height="3", width="16", command=sg) b3 = Button(w, text="Play a sound", command=ps) L1 = Label(w, text=time, foreground="white", bg="black") l1.grid(sticky=N) e1.grid(sticky=N) l2.grid(sticky=N) e2.grid(sticky=N) b2.grid(pady=50, padx=250) b3.grid() L1.grid(sticky=W) # matching & names basing: w.mainloop()