Ich schreibe ein Python-Skript, um die klimatischen Bedingungen in einem bestimmten Gebiet alle 30 Minuten zu erhalten und gebe ein Popup-Benachrichtigung.Wie pybusyinfo Fenster in (Windows OS) anpassen, damit es in der oberen Ecke des Fensters und den anderen Formatierungsoptionen erscheint?
Dieser Code gibt Popup in der Mitte des Bildschirms, die nervig ist. Ich möchte das Popup ähnlich zu notify-send in linux [die in der rechten Ecke erscheint] und die Nachricht ist in der Mitte von pybusyinfo Fenster ausgerichtet, und wie man es richtig anordnet?
Jede Änderung des Codes in pybusyinfo wäre hilfreich.
import requests
from bs4 import BeautifulSoup
import datetime,time
import wx
import wx.lib.agw.pybusyinfo as PBI
now = datetime.datetime.now()
hour=now.hour
# gets current time
def main():
chrome_path = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s'
g_link = 'http://www.accuweather.com/en/in/tambaram/190794/hourly-weather-forecast/190794?hour='+str(hour)
g_res= requests.get(g_link)
g_links= BeautifulSoup(g_res.text,"lxml")
if hour > 18 :
temp = g_links.find('td', {'class' :'first-col bg-s'}).text
climate = g_links.find('td', {'class' :'night bg-s icon first-col'}).text
else :
temp = g_links.find('td', {'class' :'first-col bg-c'}).text
climate = g_links.find('td', {'class' :'day bg-c icon first-col'}).text
for loc in g_links.find_all('h1'):
location=loc.text
info = location +' ' + str(now.hour)+':'+str(now.minute)
#print 'Temp : '+temp
#print climate
def showmsg():
app = wx.App(redirect=False)
title = 'Weather'
msg= info+'\n'+temp + '\n'+ climate
d = PBI.PyBusyInfo(msg,title=title)
return d
if __name__ == '__main__':
d = showmsg()
time.sleep(6)
while True:
main()
time.sleep(1800)
d_size = d.GetSize() AttributError: 'PyBusyInfo' Objekt hat kein Attribut 'GetSize' –
es sieht aus wie PyBusyInfo ... ist nicht die aktueller Rahmen ... siehe Bearbeiten (_infoframe) –
d.infoFrame.SetPosition ((pos_x, pos_y)) –