Answer the question
In order to leave comments, you need to log in
How to make a background image in python kivy?
Hello! I have a problem, there is such a clicker:
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from kivy.uix.label import Label
class MainApp(App):
i = 0
def build(self):
main_layout = BoxLayout()
self.label = Label(text = "", size_hint = (.7, .9), pos_hint = {'center_x': 0.5, 'center_y': 0.7})
btn = Button(text = "Clicks", size_hint = (.1, .1), pos_hint = {'top_x': 0.5, 'top_y': 1})
btn.bind(on_press=self.on_button_press)
main_layout.add_widget(self.label)
main_layout.add_widget(btn)
return main_layout
def on_button_press(self, instance):
self.i += 1
self.label.text = "Clicked " + str(self.i + 1)
if __name__ == '__main__':
app = MainApp()
app.run()
fon_img = Image(source='fon1280x720.png')
main_layout.add_widget(fon_img)
TypeError: __init__() missing 1 required positional argument: 'imgtype'
Answer the question
In order to leave comments, you need to log in
FloatLayout: #Общий
id:fl1
orientation: 'vertical'
canvas:
Rectangle:
source: 'Fon.jpg'
size: self.size
pos: self.pos
#rows: 6
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question