Python Tkinter "Aptal mısın?" | CriminalZ.Org • Hack Forum

Python Tkinter "Aptal mısın?"

teemo

teemo

VIP CRIMINAL
LV
11
 
Awards
5
Merhaba, instagramda kod sayfalarında gezinirken "Are u dumb?" diye soru çıkaran bir kod gördüm ve no tuşuna bastığında tuşun yeri değişirken yes tuşuna basıldığında "biliyordum" tarzı bir mesaj çıkıyor. Bende bunu hem sıkıntıdan hem de tkinter ve random modülleri için örnek bir kod olur diye kodlamaya karar verdim.

Programın görünümü böyledir. Kodlar :
Python:
from tkinter import *
from random import choice

def Evet():
    soru.destroy()
    bildim = Label(text="Bunu biliyordum :3")
    bildim.pack()

def Hayır():
    xx = [250,230,270,290,280,240]
    yy = [60,70,40,30,80]
    hayir.place(x=choice(xx), y=choice(yy))
pencere = Tk()
soru  = Label(text="Aptal mısın?")
evet = Button(text="Evet", command=Evet)
hayir = Button(text="Hayır", command=Hayır)
pencere.geometry("400x130")
evet.place(x=40,y=50,width=80)
hayir.place(x=260,y=50,width=80)
soru.pack()
pencere.mainloop()

nesne yönelimi hali
Python:
from tkinter import *
import random
class Root(Tk):
    def __init__(self):
        super().__init__()
        self.soru =  Label(text="Aptal mısın?")
        self.soru.pack()
        self.evet = Button(text="Evet", command=self.Evet)
        self.hayir = Button(text="Hayır", command=self.Hayır)
        self.geometry("400x130")
        self.evet.place(x=40,y=50,width=80)
        self.hayir.place(x=260,y=50,width=80)
        self.mainloop()
    
    def Evet(self):
        self.soru.config(text="Bunu biliyordum! ")
        
    def Hayır(self):
        self.hayir.place(x=random.randint(0,400),y=random.randint(0,130))
    
Root(
 

About Us

CriminalZ Hack Forum is a cracking forum where you can find anything related to cracking. If you are looking for a great place to learn, make new friends, CriminalZ is your new home.

DMCA & Contact

Any DMCA takedown notice should be sent to this contact email: [email protected] We only respond and take action to plaintext e-mails. Do not send PDF or any other files.

Hack Forum

Forbiddien World

Top Bottom