Reputation: 39
As you can see in the screenshot the Listview's top items are mixing with mdtoolbar. I want to display below the MDtoolbar.I tried changing the pos_hint property in MDList in kv code. but it not moving. How can I move it below? is there any way to stick it below the toolbar without pos_hint
.py file
class ListApp(Screen):
built = BooleanProperty(False)
def build(self):
if self.built:
return
self.built = True
self.popup = Popup(title='Calculating Stoploss', content=Image(source='please_wait.gif'))
self.popup.open()
threading.Thread(target=self.actual_build).start()
def actual_build(self):
end = datetime.today().date()
start = end
i = 0
fl = len(file.index)
try:
for index in range(fl):
for index in range(1):
columnSeriesObj2 = file.iloc[:, 0]
df = web.DataReader(columnSeriesObj2.values[i],'yahoo', start, end,retry_count=3)
print(df.head())
Objname = file.iloc[:, 2]
columnSeriesObj = df.iloc[:, 3]
columnSeriesObj1 = file.iloc[:, 1]
ObjStoploss = file.iloc[:, 3]
cp = iter(columnSeriesObj.values)
pp = iter(columnSeriesObj1.values)
pp1 = next(pp)
cp1 = columnSeriesObj.values[0]
sl = columnSeriesObj1.values[i] - (columnSeriesObj1.values[i] * (ObjStoploss.values[i]/100))
if cp1 <= sl:
Clock.schedule_once(partial(self.add_loss, Objname.values[i], str(cp1), str(sl)))
i=i+1
else:
Clock.schedule_once(partial(self.add_profit, Objname.values[i], str(cp1), str(sl)))
i=i+1
except ConnectionAbortedError:
print("Check your Internet connection")
except ConnectionRefusedError:
print("Check your Internet connection")
except ConnectionError:
print("Check your Internet connection")
except ConnectionResetError:
print("Check your Internet connection")
except TimeoutError:
print("Timeout!!!!...Check your Internet connection")
except KeyError:
pass
except:
pass
# print("Something went wrong")
print("Done")
self.popup.dismiss()
def add_loss(self, name, close_price, stop_loss, dt):
image = ImageLeftWidget(source='loss.png')
items = ThreeLineAvatarIconListItem(text="Alert sale " + name, secondary_text='Close price: '+close_price,
tertiary_text='Stoploss: ' + stop_loss)
items.add_widget(image)
self.ids.list_view.add_widget(items)
def add_profit(self, name, close_price, stop_loss, dt):
image = ImageLeftWidget(source='profit.jpg')
items = ThreeLineAvatarIconListItem(text="Chill " + name,
secondary_text='Close price: ' + close_price,
tertiary_text='Stoploss: ' + stop_loss)
items.add_widget(image)
self.ids.list_view.add_widget(items)
# class WindowsManager(ScreenManager):
# pass
sm = ScreenManager()
sm.add_widget(ListApp(name='Stoploss_ip'))
class run1(MDApp):
def build(self):
kv = Builder.load_file("stopl.kv")
return kv
if __name__ == "__main__":
run1().run()
.kv file
<ListApp>:
name: 'Stoploss_ip'
orientation:'vertical'
on_enter:root.build()
MDToolbar:
title:'Stoploss'
type: "top"
md_bg_color:229/255,33/255,101/255,1
left_action_items: [["back button.png", lambda x: root.back()]]
pos_hint: {'top':1.0}
elevation:8
ScrollView:
MDList:
id: list_view
pos_hint: {'y':3.0}
here is link for stoploss.csv file
Upvotes: 0
Views: 44