Skip to content

Python id "hiba" #36

Answered by obragaa
Fulop95 asked this question in Q&A
May 8, 2024 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

A hiba a programban van, de könnyen megoldható. Az "id" attribútumot hibásan használtad a gombokon. Ha elhagyod az "id" attribútumot, akkor működik a program. A javított kód a következőképpen néz ki:

import os

cwd = os.getcwd()
os.environ['KIVY_HOME'] = cwd + '/kivy'

from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.widget import Widget

class AlapWidget(Widget):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        gomb1 = Button(text="Gomb 1", size=(100, 50), pos=(0,0))
        gomb1.bind(on_press=self.hello_gomb)
        self.add_widget(gomb1)

        gomb2 = Button(text="Gomb 2", size=(100, 50), pos=(100, 100))
        gomb2.bind(on_press

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Fulop95
Comment options

Answer selected by Fulop95
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants