I cant click in the bottons, are know why.
import kivy
kivy.require('2.0.0')
from
kivy.app import App
from kivy.uix.gridlayout import GridLayout
from kivy.uix.button import Button
from kivy.uix.popup import Popup
from kivy.uix.label import Label
from kivy.uix.image import Image
from kivy.core.window import Window
from kivy.graphics import Color, Rectangle
from kivy.config import Config
Config.set('graphics', 'show_cursor', '1')
Config.set('graphics', 'transparent', 0.5)
class MainMenu(GridLayout):
def __init__(self, **kwargs):
super(MainMenu, self).__init__(**kwargs)
self.cols = 1
self.padding = [100, 100]
self.show_grid = 'sticky'
# Fondo de pantalla
# self.background = Image(source='background.jpg', allow_stretch=True, keep_ratio=False)
# self.add_widget(self.background)
# Título
self.title = Label(text='Juego', font_size=100, size_hint=(1, 0.4), halign='center', valign='top')
self.add_widget(self.title)
# Botones
self.buttons_layout = GridLayout(cols=1, spacing=50, size_hint=(1, 0.6), padding=[50, 50, 100, 100])
self.iniciar_button = Button(text='Iniciar', size_hint=(1, 0.3))
self.iniciar_button.bind(on_press=self.init_game)
self.buttons_layout.add_widget(self.iniciar_button)
self.options_button = Button(text='Opciones', size_hint=(1, 0.3))
self.options_button.bind(on_press=self.show_options_popup)
self.buttons_layout.add_widget(self.options_button)
self.credits_button = Button(text='Créditos', size_hint=(1, 0.3))
self.credits_button.bind(on_press=self.show_credits_popup)
self.buttons_layout.add_widget(self.credits_button)
self.quit_button = Button(text='Salir', size_hint=(1, 0.3))
self.quit_button.bind(on_press=self.quit)
self.buttons_layout.add_widget(self.quit_button)
self.add_widget(self.buttons_layout)
def init_game(self, instance):
pass
def show_options_popup(self, instance):
content = Label(text='Esta es la ventana de opciones.')
popup = Popup(title='Opciones', content=content, size_hint=(0.6, 0.4))
popup.open()
def show_credits_popup(self, instance):
content = Label(text='Créditos:\n\nProgramador: Tu nombre aquí.\nDiseñador: Tu nombre aquí.')
popup = Popup(title='Créditos', content=content, size_hint=(0.6, 0.4))
popup.open()
def quit(self, instance):
App.get_running_app().stop()
Window.close()
class MyApp(App):
def build(self):
return MainMenu()
if __name__ == '__main__':
MyApp().run()
In the image, show cant click in the bottons, are know why.
in kivy, are someway to debug grill o some like that ?