• <tfoot id='oor7S'></tfoot>

    <i id='oor7S'><tr id='oor7S'><dt id='oor7S'><q id='oor7S'><span id='oor7S'><b id='oor7S'><form id='oor7S'><ins id='oor7S'></ins><ul id='oor7S'></ul><sub id='oor7S'></sub></form><legend id='oor7S'></legend><bdo id='oor7S'><pre id='oor7S'><center id='oor7S'></center></pre></bdo></b><th id='oor7S'></th></span></q></dt></tr></i><div id='oor7S'><tfoot id='oor7S'></tfoot><dl id='oor7S'><fieldset id='oor7S'></fieldset></dl></div>

    1. <small id='oor7S'></small><noframes id='oor7S'>

          <bdo id='oor7S'></bdo><ul id='oor7S'></ul>
      1. <legend id='oor7S'><style id='oor7S'><dir id='oor7S'><q id='oor7S'></q></dir></style></legend>

        Python,Kivy,“AssertionError: None is not callable"按钮调用函

        时间:2023-06-06

          <tbody id='Du3lM'></tbody>

        <small id='Du3lM'></small><noframes id='Du3lM'>

      2. <tfoot id='Du3lM'></tfoot>

              • <i id='Du3lM'><tr id='Du3lM'><dt id='Du3lM'><q id='Du3lM'><span id='Du3lM'><b id='Du3lM'><form id='Du3lM'><ins id='Du3lM'></ins><ul id='Du3lM'></ul><sub id='Du3lM'></sub></form><legend id='Du3lM'></legend><bdo id='Du3lM'><pre id='Du3lM'><center id='Du3lM'></center></pre></bdo></b><th id='Du3lM'></th></span></q></dt></tr></i><div id='Du3lM'><tfoot id='Du3lM'></tfoot><dl id='Du3lM'><fieldset id='Du3lM'></fieldset></dl></div>
                • <bdo id='Du3lM'></bdo><ul id='Du3lM'></ul>

                  <legend id='Du3lM'><style id='Du3lM'><dir id='Du3lM'><q id='Du3lM'></q></dir></style></legend>
                  本文介绍了Python,Kivy,“AssertionError: None is not callable"按钮调用函数时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  所以我想使用此代码在按下按钮时调用函数:

                  So I whant to use this code to call a function on a button press:

                  botao_ok.bind(on_press=f_adicionar_socios(txt_n_socio.text,txt_nome.text,txt_filho_de.text,txt_filho_e_de.text,txt_data_nas.text,txt_tipo_ID.text,txt_num_ID.text,txt_NIF.text,txt_morada_rua.text,txt_morada_localidade.text,txt_codigo_postal.text,txt_tel_fixo.text,txt_telemovel.text,txt_email.text,txt_tipo_socio.text,txt_data_admicao.text,txt_zona.text,txt_actividade.text,txt_actividade_de.text,txt_actividade_ate.text,txt_observacoes.text))
                  

                  但为了简单起见,我只需要解决这个问题:

                  But to keep it simple, I only need to solve this problem:

                  #My Function
                  def teste_(nome):
                      print nome
                  #Button
                  botao_ok.bind(on_press=teste_('Ola'))
                  # Button is inside a Class MYApp
                  

                  它给出了错误:AssertionError: None is not callable

                  and it gives the error: AssertionError: None is not callable

                  我已经尝试了所有我强硬的方法但无法解决这个问题......谢谢

                  Ive tryied everything I tough off and can't solve this... Thank you

                  推荐答案

                  当你编写 teste_('Ola') 函数运行并返回 None

                  When you write teste_('Ola') the function runs and returns None

                  所以当你写的时候

                  botao_ok.bind(on_press=teste_('Ola'))
                  

                  它实际上被设置为:

                  botao_ok.bind(on_press=None)
                  

                  简而言之,这是导致您的问题的原因.

                  Which in short is causing your problem.

                  为了让它调用 teste_('Ola') 当按钮被按下时,你可以使用 lambda 函数:

                  In order to get it to call teste_('Ola') When the button is pressed, you could use a lambda function:

                  botao_ok.bind(on_press=lambda x:teste_('Ola'))
                  

                  这篇关于Python,Kivy,“AssertionError: None is not callable"按钮调用函数时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:具有多项选择的 kivy 微调器小部件 下一篇:Kivy/Python Countdown App 项目 kivy 没有属性 'built' 错误

                  相关文章

                  <small id='NJnK9'></small><noframes id='NJnK9'>

                    <legend id='NJnK9'><style id='NJnK9'><dir id='NJnK9'><q id='NJnK9'></q></dir></style></legend>

                    • <bdo id='NJnK9'></bdo><ul id='NJnK9'></ul>
                    1. <tfoot id='NJnK9'></tfoot>

                    2. <i id='NJnK9'><tr id='NJnK9'><dt id='NJnK9'><q id='NJnK9'><span id='NJnK9'><b id='NJnK9'><form id='NJnK9'><ins id='NJnK9'></ins><ul id='NJnK9'></ul><sub id='NJnK9'></sub></form><legend id='NJnK9'></legend><bdo id='NJnK9'><pre id='NJnK9'><center id='NJnK9'></center></pre></bdo></b><th id='NJnK9'></th></span></q></dt></tr></i><div id='NJnK9'><tfoot id='NJnK9'></tfoot><dl id='NJnK9'><fieldset id='NJnK9'></fieldset></dl></div>