rom kivy.app import App
from kivy.lang import Builder
from kivy.uix.image import Image
ts=Builder.load_string("""
BoxLayout:
orientation:"vertical"
Image:
source:"2.jpg"
id: a
Image:
source:"5.jpg"
id: ab
Image:
source:"6.jpg"
id: b
Button:
text:"git"
size_hint_y: .2
""")
class uygulama(App):
def build(self):
return ts
uygulama().run()
Resimleri diğer kodlama ile tıklayarak gösterebiliyorum.Ama kv dili ile pek bilmiyorum.
Böyle yapınca resimler alt alta sıralanıyor.Resimleri tek tek nasıl gösteririm.
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.gridlayout import GridLayout
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.core.window import Window
import os
Builder.load_string("""
<ekran1>:
GridLayout:
cols:2
padding:20
spacing:20
Label:
text:"Kullanıcı adı"
font_size: sp(25)
TextInput:
id: user
multiline:False
Label:
text:"Parola adı"
font_size: sp(25)
id: lbl
TextInput:
id: par
multiline:False
Button:
text:"Git"
on_release:root.gir()
color: 1,0,0,1
Label:
text:"Bu program Windows 7 için uyumludur"
font_size: sp(22)
<ekran2>:
GridLayout:
cols:3
padding:10
Button:
text:"Görev Yoneticisi"
size_hint_y: .2
on_press:root.degistir11()
Button:
text:"Denetim Masası"
size_hint_y: .2
on_press:root.degistir1()
Button:
text:"Kayıt defteri"
size_hint_y: .2
on_press:root.degistir2()
Button:
text:"oturum Kapat"
size_hint_y: .2
on_press:root.degistir3()
color: 1,0,0,1
Button:
text:"Yeniden Baslat"
size_hint_y: .2
on_press:root.degistir4()
color: 1,0,0,1
Button:
text:"Bilgisayarı Kapat"
size_hint_y: .2
on_press:root.degistir5()
color: 1,0,0,1
Button:
text:"Temizleme"
size_hint_y: .2
on_press:root.degistir6()
Button:
text:"Bilgisayar Yonetim"
size_hint_y: .2
on_press:root.degistir7()
Button:
text:"Disk Yonetimi"
size_hint_y: .2
on_press:root.degistir8()
Button:
text:"Sistem Bilgi"
size_hint_y: .2
on_press:root.degistir9()
Button:
text:"Ekran aıntısı"
size_hint_y: .2
on_press:root.degistir10()
Button:
text:"Disk Birlestirme"
size_hint_y: .2
on_press:root.degistir12()
Button:
text:"Sistem Yukleme"
size_hint_y: .2
on_press:root.degistir13()
Button:
text:"Programdan Çıkış"
on_release: quit()
size_hint_y: .2
# color: 1,0,0,1 bu satırları yazınca şifreyi pas geçti
Button:
text:"Ana Ekrana Don"
size_hint_y: .2
# color: 1,0,0,1 bu satırları yazınca şifreyi pas geçti
on_release:
root.manager.transition.direction="left"
root.manager.current="ekran1"
""")
class ekran2(Screen):
def degistir11(self):
if os.system("taskmgr"):
print("yonetim")
def degistir1(self):
if os.system("control panel"):
print("denetim masasi")
def degistir2(self):
if os.system("regedit"):
print("anahtar")
def degistir3(self):
if os.system("shutdown/l"):
print("oturum")
def degistir4(self):
if os.system("shutdown/r"):
print("reboot")
def degistir5(self):
if os.system("shutdown/s"):
print("kapatma")
def degistir6(self):
if os.system("cleanmgr"):
print("temizle")
def degistir7( self):
if os.system("compmgmt"):
print("yonetim")
def degistir8(self):
if os.system("diskmgmt"):
print("yonetim")
def degistir9( self):
if os.system("msinfo32"):
print("yonetim")
def degistir10(self):
if os.system("SnippingTool"):
print("alinti")
def degistir12( self):
if os.system("dfrgui"):
print("defrag")
def degistir13( self):
if os.system("msconfig"):
print("yukleme")
class ekran1(Screen):
def gir(self):
if not self.ids.user.text or not self.ids.par.text:
self.ids.lbl.color = 1,0,0,1
self.ids.lbl.text = "Boş yer bırakamyın"
elif self.ids.user.text == "asd" and self.ids.par.text == "123":
self.ids.lbl.color = 0,1,0,1
self.ids.lbl.text = "Bilgiler doğru hoşgeldiniz"
self.manager.current = "ekran2" #Bu kod doğru ise ikinci ekrana gidiyor.
elif self.ids.user.text != "asd" or self.ids.par.text == "123":
self.ids.lbl.color = 1,0,0,1
self.ids.lbl.text="Kullanıcı adı yada parola hatalı..."
self.ids.user.text =" " #silme
self.ids.par.text = " "
else:
pass
sm = ScreenManager()
sm.add_widget(ekran1(name="ekran1"))
sm.add_widget(ekran2(name="ekran2"))
class ekranApp(App):
def build(self):
return sm
Window.clearcolor=(0,0,8,1)
ekranApp().run()
Bu kodla windows 7 araçlarını açabiliyorum.
Umarım Beğenmiştirsin.
Bunun gibi androide de yapabilirmiyim.