I need to add a checkbox to this Kivy Canvas but it don"t know how to do it properly. I need the checkbox to display the name of all the file in the folder Data. Then the user check the file he wants and then by pressing a button (here the red one) it return a list of the file name and call some functions. Here is where i am right now.
from kivy.app import App
from kivy.core.window import Window
from kivy.uix.image import Image
from kivy.uix.widget import Widget
from kivy.metrics import dp
from kivy.lang import Builder
from kivy.uix.label import Label
from kivy.uix.button import Button
from kivy.base import runTouchApp
from kivy.uix.recycleview import RecycleView
from kivy.uix.popup import Popup
from kivy.uix.progressbar import ProgressBar
from kivy.uix.boxlayout import BoxLayout
from kivy.clock import Clock
from kivy.uix.button import Button
from kivy.uix.popup import Popup
from kivy.uix.widget import Widget.
from kivy.properties import ObjectProperty
import time
import os
Builder.load_string('''<Game>
ShootButton:
<ShootButton>
Image:
source: 'logo.jpg'
allow_stretch: True
size: 300,300
pos: 300, 400
Image:
source: 'livre.jpg'
allow_stretch: True
size: 350, 350
pos: 490,130
Button:
text: "Modifier Correspondance"
size: 240,50
font_size: 20
pos: 100,300
background_color :0, 1, 0, 1,
on_press: root.shoot()
Button:
text: "Liste Fichiers"
size: 240,50
font_size: 20
pos: 100,400
background_color :0, 1, 0, 1,
on_press: root.fire_popup()
Button:
text: "Ajouter Fichier"
size: 240,50
font_size: 20
pos: 100,200
background_color :0, 1, 0, 1,
on_press: root.shoot2()
Button:
text: "Generer PDF"
size: 180,50
font_size: 20
pos: 580,60
background_color :1, 0, 0, 1,
on_press: root.display()
''')
Window.size = (900, 600)
Window.clearcolor = (1, 1, 1, 1)
class Game(Widget):
pass
class SimplePopup(Popup):
pass
class SimplePopup2(Popup):
pass
class ShootButton(Widget):
def shoot(self):
shooting = Bullet()
shooting.bullet_fly()
def shoot2(self):
shooting = Bullet()
shooting.bullet_fly2()
class Bullet(Widget):
def bullet_fly(self):
print("test")
def bullet_fly2(self):
os.system("open .")
class MyApp(App):
def build(self):
return Game()
if __name__ == '__main__':
MyApp().run()
Aucun commentaire:
Enregistrer un commentaire