2012-02-12 19 views
0

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

私の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

答えて

3

間違ってApplicationの代わりにCustomDialogを作成しました。問題を解決するには、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 
} } 
関連する問題