Kivy下载了bug

时间:2014-09-13 14:10:00

标签: python frameworks kivy

当在Kivy中生成此下拉菜单时,如果窗口大小增加,然后再次减小,菜单将停止工作。 这是某种错误吗?

from kivy.app import App
from kivy.uix.spinner import Spinner, SpinnerOption
from kivy.base import runTouchApp
from kivy.uix.gridlayout import GridLayout
from kivy.lang import Builder
from kivy.uix.popup import Popup
from kivy.uix.button import Button
from kivy.uix.dropdown import DropDown

Builder.load_string('''
<Janela1>:
    size_hint: .4, .4
    auto_dismiss: True
    title: 'HAAAAAAAAAAAAAAAAa'
    Button:
        text: 'Click me to dismiss'
        on_press: root.dismiss()
''')


class Tela(GridLayout):
    pass

class Janela1(Popup):
    pass

class programa(App):
    def build(self):
        dropdown=DropDown()
        raiz = Tela(cols=4, row_force_default=True, row_default_height=40) #declarando  o fundo

        btn = Button(text='Valor 1', size_hint_y=None, height=44)
        btn.bind(on_release=self.show_popup)
        btn.bind(on_release=lambda btn: dropdown.select(btn.text))
        dropdown.add_widget(btn)


        i = 0
        for lista in range(4):  
            lista=['Intervalos','Ritmo','Identificacao dos Modos','Acordes']
            mainbutton = Button(text='%s' % lista[i], size_hint_y=None, height=44)
            i += 1

            mainbutton.bind(on_release=dropdown.open)

            mainbutton.bind(on_select=lambda instance, x: setattr(mainbutton, 'text', x))
            raiz.add_widget(mainbutton)


        return raiz

    def show_popup(self, raiz):
        p = Janela1()
        p.open()


if __name__ == '__main__':
    programa().run()

1 个答案:

答案 0 :(得分:0)

我在Windows中使用python和kivy并遇到各种各样的问题。我确实使用了虚拟机和kivy VM,解决了大量问题。因此,如果您要坚持使用Windows进行开发,我会使用它:http://kivy.org/docs/guide/packaging-android-vm.html