0

したがって、私はPythonCardを使い始めたばかりで、最も基本的なアプリを動作させることができません:Sボタンをクリックすると、TextFieldsの値を変数に割り当てようとしています。問題が何であるかを理解できるかどうかを確認してください:D

私のpythonメインファイル:

from PythonCard import model

class register(model.Background):
    def on_register_mouseClick(self, event):
        title = self.components.title.text
        artist = self.components.artist.text


if __name__ == '__main__':
    app = model.Application(register)
    app.MainLoop()

私のリソースファイル:

{'type':'CustomDialog',
    'name':'Template',
    'title':'Dialog Template',
    'position':(125, 125),
    'size':(300, 181),
    'components': [

{'type':'TextField', 
    'name':'artist', 
    'position':(115, 48), 
     'text':'artist', 
},

{'type':'TextField', 
    'name':'title', 
    'position':(116, 15), 
    'text':'title', 
    },

{'type':'Button', 
    'id':5100, 
    'name':'register', 
    'position':(10, 35), 
    'default':1, 
    'label':'OK', 
},

] # end components
} # end CustomDialog

前もって感謝します!:D

4

1 に答える 1

3

間違って のCustomDialog代わりに を作ってしまいましたApplication。問題を解決するには、rsrc ファイルを次のコードに置き換えます。

{'application':{'type':'Application',
          'name':'Template',
    'backgrounds': [
    {'type':'Background',
          'name':'Application',
          'title':u'Application',
          'size':(300, 181),

         'components': [

{'type':'Button', 
    'name':'register', 
    'position':(10, 35), 
    'default':True, 
    'label':u'OK', 
    },

{'type':'TextField', 
    'name':'title', 
    'position':(116, 15), 
    'text':u'title', 
    },

{'type':'TextField', 
    'name':'artist', 
    'position':(115, 48), 
    'text':u'artist', 
    },

] # end components
} # end background
] # end backgrounds
} }
于 2012-10-17T23:48:28.493 に答える