Run file with kivy python

0

I'm doing a crud maintenance using python / kivy. There are four main files, one for P table, one for A, and one for C. The fourth main file is the main screen which will have three buttons for you to choose which table to edit and, when clicked on this button, runs the main of the selected table. But I do not remember how I execute a file when the button is clicked. Here is the main code in python:

import kivy
from main_Aluno.py import Manutencao_A
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button 

class TelaPrincipal(App):
    pass

class Button(BoxLayout):
    def clickA(self)
        return main_Aluno.py
    def clickP(self):
        return main_Professor.py
    def clickC(self): 
        return main_Curso.py

botao = TelaPrincipal()
botao.run() 

Note: Manupply_A is the class that contains the main A

I do not know if it's relevant but it follows the code in kivy too:

<Button@BoxLayout>:
    orientation: vertical

    Label:
        text: "Escolha a tela a ser editada"
    Button: 
        text: "Alunos"
        on_press: root.clickA()
    Button:
        text: "Professores" 
        on_press: root.clickP()
    Button:
        text: "Cursos"
        on_press: root.clickC()  
    
asked by anonymous 20.06.2017 / 13:44

1 answer

1

You should be wanting to run the files through functions importing the classes is not it?

import kivy
import main_Aluno, main_Professor, main_Curso
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button 

class TelaPrincipal(App):
    pass

class MainButtons(Button):
    def clickA(self):
        main_Aluno.funcaoA()
    def clickP(self):
        main_Professor.funcaoP()
    def clickC(self): 
        main_Curso.funcaoC()

botao = TelaPrincipal()
botao.run() 

Kv file

BoxLayout:
    orientation: vertical

    Label:
        text: "Escolha a tela a ser editada"
    MainButtons: 
        text: "Alunos"
        on_press: self.clickA()
    MainButtons:
        text: "Professores" 
        on_press: self.clickP()
    MainButtons:
        text: "Cursos"
        on_press: self.clickC()  
    
27.10.2017 / 02:15