fix tree_data passing between objects
This commit is contained in:
parent
b0fc60c6be
commit
6cdde6b73e
3 changed files with 10 additions and 5 deletions
|
@ -41,7 +41,7 @@ class ForestMapView(MapView):
|
||||||
# Create TreeMarker
|
# Create TreeMarker
|
||||||
lat, lon = tree[20], tree[21]
|
lat, lon = tree[20], tree[21]
|
||||||
treemarker = TreeMarker(lat=lat, lon=lon)
|
treemarker = TreeMarker(lat=lat, lon=lon)
|
||||||
treemarker.tree_data = treemarker
|
treemarker.tree_data = tree
|
||||||
|
|
||||||
# Add TreeMarker to the map
|
# Add TreeMarker to the map
|
||||||
self.add_widget(treemarker)
|
self.add_widget(treemarker)
|
||||||
|
|
5
game.py
5
game.py
|
@ -1,4 +1,9 @@
|
||||||
from kivy.uix.widget import Widget
|
from kivy.uix.widget import Widget
|
||||||
|
from math import sqrt
|
||||||
|
|
||||||
|
def money_rate(happiness):
|
||||||
|
rate = sqrt(1 / happiness)
|
||||||
|
return rate
|
||||||
|
|
||||||
def collides(rect1, rect2):
|
def collides(rect1, rect2):
|
||||||
r1x = rect1[0][0]
|
r1x = rect1[0][0]
|
||||||
|
|
|
@ -4,7 +4,7 @@ class TreePopupMenu(ListMDDialog):
|
||||||
def __init__(self, tree_data):
|
def __init__(self, tree_data):
|
||||||
super().__init__()
|
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
|
# Set all of the fields of tree data
|
||||||
#headers = "Name,Lat,Lon,Description"
|
#headers = "Name,Lat,Lon,Description"
|
||||||
|
@ -13,7 +13,7 @@ class TreePopupMenu(ListMDDialog):
|
||||||
|
|
||||||
for i in range(len(headers)):
|
for i in range(len(headers)):
|
||||||
attribute_name = headers[i]
|
attribute_name = headers[i]
|
||||||
print("attr name " + attribute_name)
|
#print("attr name " + str(attribute_name))
|
||||||
attribute_value = tree_data[i]
|
attribute_value = tree_data[i]
|
||||||
print("attr value " + attribute_value)
|
#print("attr value " + str(attribute_value))
|
||||||
setattr(self, attribute_name, attribute_value)
|
setattr(self, attribute_name, attribute_value)
|
||||||
|
|
Loading…
Reference in a new issue