Exemple #1
0
 def initApp(self):
   #Connect Here
   self.client = P2PClientManager.getClient(port=random.randint(40000, 60000))
   self.client.subscribe(Message.NEW_TRANSACTION, self.update_balance)
   self.client.subscribe_to_info(self.update_status)
   t = threading.Thread(target=self.start_miner)
   t.start()
   if not self.db.hasRanBefore():
     c = CoinBase(owner=KeyStore.getPrivateKey(), amt=100)
     c.finish_transaction()
     self.db.setRanBefore()
     #messagebox.showinfo('Welcome', 'This is your first time running the app. You get to start off with 100 PyCoins!')
   #Get balance, Save to variable below
   self.coin_balance.set(str(KeyStore.get_balance()))
   print('PyCoin Address: ', SHA.new(KeyStore.getPublicKey().exportKey()).hexdigest())
   log.debug("GUI created")
Exemple #2
0
 def update_balance(self, t=None):
   bal = str(KeyStore.get_balance())
   self.coin_balance.set(bal)