fix tree_data passing between objects

This commit is contained in:
Daniel afx 2020-10-15 13:52:18 +03:00
parent b0fc60c6be
commit 6cdde6b73e
3 changed files with 10 additions and 5 deletions

View file

@ -41,7 +41,7 @@ class ForestMapView(MapView):
# Create TreeMarker
lat, lon = tree[20], tree[21]
treemarker = TreeMarker(lat=lat, lon=lon)
treemarker.tree_data = treemarker
treemarker.tree_data = tree
# Add TreeMarker to the map
self.add_widget(treemarker)

View file

@ -1,4 +1,9 @@
from kivy.uix.widget import Widget
from math import sqrt
def money_rate(happiness):
rate = sqrt(1 / happiness)
return rate
def collides(rect1, rect2):
r1x = rect1[0][0]
@ -67,4 +72,4 @@ class GameWidget(Widget):
if collides((self.player.pos,self.player.size),(self.enemy.pos,self.size)):
print("X")
else:
print('.')
print('.')

View file

@ -4,7 +4,7 @@ class TreePopupMenu(ListMDDialog):
def __init__(self, tree_data):
super().__init__()
print("] Selected tree data: " + str(dir(tree_data)))
print("] Selected tree data: " + str(tree_data))
# Set all of the fields of tree data
#headers = "Name,Lat,Lon,Description"
@ -13,7 +13,7 @@ class TreePopupMenu(ListMDDialog):
for i in range(len(headers)):
attribute_name = headers[i]
print("attr name " + attribute_name)
#print("attr name " + str(attribute_name))
attribute_value = tree_data[i]
print("attr value " + attribute_value)
#print("attr value " + str(attribute_value))
setattr(self, attribute_name, attribute_value)