Butona yetki verme


from kivy.app import App
from kivy.lang import Builder
from kivy.core.window import Window

kv="""
FloatLayout:
    padding:10
    Label:
        text:"Kullanıcı Adı"
        id: lbl
        font_size: sp(22)
        
        size_hint:(0.1,0.1)
        pos_hint:{"x":0.1,"y":.8}
        color: 0,0.8,1,2
    TextInput
        id: txt
        multiline:False
        size_hint:(0.2,0.1)
        pos_hint:{"x":.3,"y":.8}
    Label:
        text:"Kullanıcı Şifresi"
        id: lbl1
        font_size: sp(22)
        size_hint:(0.1,0.1)
        pos_hint:{"x":.1,"y":.7}
        color: 0,0.8,1,2
    TextInput
        id: txt1 
        multiline:False
        size_hint:(0.2,0.1)
        pos_hint:{"x":0.3,"y":.7}
    Button:
        text:"gir"
        size_hint:(0.1,0.1)
        pos_hint:{"x":.3,"y":.6}
        background_color: 1,0,0,2
        on_release:app.user()
    Button:
        text:"gir"
        size_hint:(0.2,0.4)
        pos_hint:{"x":.6,"y":.6}
        id: btn
        on_release:app.izin ()
    Button:
        text:"oku"
        size_hint:(0.2,0.4)
        pos_hint:{"x":.8,"y":.6}
        id: btn
        on_release:app.izin2 ()    
    TextInput:
        id:izin
        size_hint:(0.4,0.3)
        pos_hint:{"x":0.1,"y":.1}
    TextInput:
        id:izin2
        size_hint:(0.4,0.3)
        pos_hint:{"x":0.5,"y":.1}
       
  
"""	
liste=[]
class uygulama(App):
	def build(self):
		return  Builder.load_string(kv)
	def izin2(self):
		dosya=open("dos.txt","r")
		self.yazı=(dosya.read())
		self.root.ids.izin2.text="%s"% self.yazı
		
	def izin(self):
	    dosya=open("dos.txt","a+")
	    dosya.write(self.root.ids.izin.text)
	    dosya.write("\n")
		   
	def user(self):
		if self.root.ids.txt.text=="asd":
			self.root.ids.lbl.text="Kullanıcı Adı Doğru"
			self.root.ids.btn.text="onaylı"
		else:
			self.root.ids.lbl.text="Kullanıcı Adı Yanlıs"
			self.root.ids.btn.text="onaysız"
			
		if self.root.ids.txt1.text=="123":
			self.root.ids.lbl1.text="Kullanıcı şifresi Doğu"
			
		else:
			self.root.ids.lbl1.text="Kullanıcı şifresi Yanlıs"	
	
			
			
			
Window.clearcolor=(0.6,0,0.5,0.1)	
uygulama().run()
# kullanıcı şifresini girdiğimde sağ üste bulunan iki tane oku ve gir düğmesi aktif hale gelmeli ve aşağıda bulunan text  aktif olmalı.Şifreyi yanlış girersem düğmeler ve text  pasif olmalı.

disabled kullanabilirsin.
(disabled = False veya disabled = True)

Dediğin gibi yaptım butonlar pasif oldu.Kullanıcı şifreyi. girdinğimde aktif olması lazım.

Biraz sonra atarım. :slight_smile:

Geç attım kusura bakma, işim vardı. :slight_smile:


from kivy.app import App
from kivy.lang import Builder
from kivy.core.window import Window
kv="""
FloatLayout:
    padding:10
    Label:
        text:"Kullanıcı Adı"
        id: lbl
        font_size: sp(22)
        size_hint:(0.1,0.1)
        pos_hint:{"x":0.1,"y":.8}
        color: 0,0.8,1,2
    TextInput
        id: txt
        multiline:False
        size_hint:(0.2,0.1)
        pos_hint:{"x":.3,"y":.8}
    Label:
        text:"Kullanıcı Şifresi"
        id: lbl1
        font_size: sp(22)
        size_hint:(0.1,0.1)
        pos_hint:{"x":.1,"y":.7}
        color: 0,0.8,1,2
    TextInput
        id: txt1 
        multiline:False
        size_hint:(0.2,0.1)
        pos_hint:{"x":0.3,"y":.7}
    Button:
        text:"gir"
        size_hint:(0.1,0.1)
        pos_hint:{"x":.3,"y":.6}
        background_color: 1,0,0,2
        on_release:app.user()
    Button:
        disabled: True
        text: "gir"
        id: btn1
        size_hint:(0.2,0.4)
        pos_hint:{"x":.6,"y":.6}
        on_release:app.izin ()
    Button:
        disabled: True
        text: "oku"
        id: btn2
        size_hint:(0.2,0.4)
        pos_hint:{"x":.8,"y":.6}
        on_release: app.izin2 ()    
    TextInput:
        disabled: True
        id:izin
        size_hint:(0.4,0.3)
        pos_hint:{"x":0.1,"y":.1}
    TextInput:
        disabled: True
        id: izin2
        size_hint:(0.4,0.3)
        pos_hint:{"x":0.5,"y":.1}
""" 
liste=[]
class uygulama(App):
    def build(self):
        return  Builder.load_string(kv)
    def izin2(self):
        dosya=open("dos.txt","r")
        self.yazı=(dosya.read())
        self.root.ids.izin2.text="%s"% self.yazı
    def izin(self):
        dosya=open("dos.txt","a+")
        dosya.write(self.root.ids.izin.text)
        dosya.write("\n")
    def user(self):
        if self.root.ids.txt.text == "asd" and self.root.ids.txt1.text == "123":
            self.root.ids.lbl.text = "Kullanıcı Adı Dogru!"
            self.root.ids.lbl1.text = "Şifre Dogru!"
            self.root.ids.btn1.disabled = False
            self.root.ids.btn2.disabled = False
            self.root.ids.izin.disabled = False
            self.root.ids.izin2.disabled = False
        elif self.root.ids.txt.text != "asd" and self.root.ids.txt1.text == "123":
            self.root.ids.btn1.disabled = True
            self.root.ids.btn2.disabled = True
            self.root.ids.izin.disabled = True
            self.root.ids.izin2.disabled = True
            self.root.ids.lbl.text = "Kullanıcı Adı Yanlış!"
            self.root.ids.lbl1.text = "Şifre Dogru!"
        elif self.root.ids.txt.text == "asd" and self.root.ids.txt1.text != "123":
            self.root.ids.btn1.disabled = True
            self.root.ids.btn2.disabled = True
            self.root.ids.izin.disabled = True
            self.root.ids.izin2.disabled = True
            self.root.ids.lbl.text = "Kullanıcı Adı Dogru!"
            self.root.ids.lbl1.text = "Şifre Yanlış!"
        else:
            self.root.ids.btn1.disabled = True
            self.root.ids.btn2.disabled = True
            self.root.ids.izin.disabled = True
            self.root.ids.izin2.disabled = True
            self.root.ids.lbl.text = "Kullanıcı Adı Yanlış!"
            self.root.ids.lbl1.text = "Şifre Yanlış!"
Window.clearcolor=(0.6,0,0.5,0.1)   
uygulama().run()

Önemli değil .Teşekkürler.Boş zamanımızı değerlendiriyorum.