def gettext(souptext ,filename): entries = [] entry = [] concat_str = '' for ddd in souptext.find_all('dd'): if (ddd.get('class') != None and (ddd.get('class')[0] == '' or ddd.get('class')[0] == 'first')): nametimes=ddd.find_all('a') stars=ddd.find_all('span') comments=ddd.find_all('h3') concat_str4="" '''for name in nametimes: if(name.get('title')!=None and name.get('class')==None): concat_str4=(name.get('title').encode('utf-8')).strip()''' concat_str4=(nametimes[0].get('title').encode('utf-8')).strip() concat_str2='Null' for star in stars: if(star.get('class') != None and star.get('entertime')==None): concat_str2=(star.get_text().encode('utf-8')).strip() concat_str = '' for time in nametimes: if(time.get('entertime') != None): concat_str1=(time.get('entertime').encode('utf-8')).strip() for comment in comments: concat_str3=(comment.get_text().encode('utf-8')).strip() concat_str = '' concat_str=((concat_str4+"\t")+(concat_str2+"\t")+(concat_str1+"\t")+concat_str3) entry.append(concat_str) entries.append(entry) with open(filename,'a') as output: writer = csv.writer(output, delimiter= '\n', lineterminator = '\n') writer.writerows(entries)
def generate_netcdf_burst_filename(input_netcdf_file_path, template): """ Generate the filename of a burst average netcdf for both CTD and WQM. Template should already have the time variable fully defined (calendar, units, data values). """ input_netcdf_name = os.path.basename(input_netcdf_file_path) pattern = re.compile( "^(IMOS_.*)_([0-9]{8}T[0-9]{6}Z)_(.*)_(FV0[0-9])_(.*)_END") match_group = pattern.match(input_netcdf_name) site_code = template.global_attributes['site_code'] time_range = template.get_data_range('TIME') time = template.variables['TIME'] time_range = num2date(time_range, time.get('units'), time.get('calendar', 'gregorian')) timestamp_format = '%Y%m%dT%H%M%SZ' time_min = time_range[0].strftime(timestamp_format) time_max = time_range[1].strftime(timestamp_format) time_created = template.date_created.strftime(timestamp_format) burst_filename = "%s_%s_%s_FV02_%s-burst-averaged_END-%s_C-%s.nc" % ( match_group.group(1), time_min, site_code, match_group.group(5), time_max, time_created) return burst_filename
def zeitabfrage(dic): drei_h_takt = 1 now = datetime.datetime.now() time = dic.get('time') jahr = time.get('year') if jahr == 'None': jahr = str(now.year) tag = time.get('day') if tag == 'None': tag = str(now.day) if int(tag) <= 9: tag = '0' + tag monat = time.get('month') if monat == 'None': monat = str(now.month) if int(monat) <= 9: monat = '0' + monat stunde = time.get('hour') if stunde == 'None': stunde = '13' minute = time.get('minute') if minute == 'None': minute = str(now.minute) zeit = jahr + '-' + monat + '-' + tag + ' ' + stunde + ':' + minute + ':000000' zeit = datetime.datetime.strptime(zeit, '%Y-%m-%d %H:%M:%f') differenz = zeit - now if differenz.total_seconds() >= 40*10800: zeit = 'Ich kann leider nicht so weit in die Zukunft sehen.' #Möchtest du wissen, wie das Wetter in 5 Tagen wird? return zeit
def enter_pressed(event): if ((len(time.get()) == 5) and (time.get()[2] == ':') and (time.get()[0:1].isnumeric()) and (time.get()[3:4].isnumeric())): self.selectedRoutineActTime = [time.get()] self.select_routineDeactTime_frame() else: return
def DistTime(): if len(Itinerary) >= 2: for i in range(len(Itinerary) - 1): #making the url start = trippy.get(Itinerary[i]) startid = start[0] end = trippy.get(Itinerary[i + 1]) endid = end[0] MyUrl = ( 'https://maps.googleapis.com/maps/api/distancematrix/json?units=imperial&origins=place_id:%s&destinations=place_id:%s&key=%s' ) % (startid, endid, AUTH_KEY) place = requests.get(MyUrl) response_data = place.json() if response_data.get("status") == "OK": rows = [response_data["rows"]] element = rows[0] elements = element[0] miles = elements.get("elements") time = miles[0].get("duration") ########Itinerary[i] to Itinerary[i+1] duration = time.get("text") masterduration.append(duration) mile = miles[0].get("distance") distance = mile.get("text") masterdistance.append(distance) #planner[x]=answers #output=planner #print(planner) else: return ("No road path or internal error.") start = trippy.get(Itinerary[len(Itinerary) - 1]) startid = start[0] end = trippy.get(Itinerary[0]) endid = end[0] MyUrl = ( 'https://maps.googleapis.com/maps/api/distancematrix/json?units=imperial&origins=place_id:%s&destinations=place_id:%s&key=%s' ) % (startid, endid, AUTH_KEY) place = requests.get(MyUrl) response_data = place.json() if response_data.get("status") == "OK": rows = [response_data["rows"]] element = rows[0] elements = element[0] miles = elements.get("elements") time = miles[0].get("duration") ########Itinerary[i] to Itinerary[i+1] duration = time.get("text") masterduration.append(duration) mile = miles[0].get("distance") distance = mile.get("text") masterdistance.append(distance)
def enter_pressed(event): if ((len(time.get()) == 5) and (time.get()[2] == ':') and (time.get()[0:1].isnumeric()) and (time.get()[3:4].isnumeric())): self.selectedRoutineDeactTime = [time.get()] self.TempWakeUpRoutines.append(self.selectedRoutineActTime[0]) self.TempWakeUpRoutines.append(self.selectedRoutineUnit) self.TempWakeUpRoutines.append( self.selectedRoutineDeactTime[0]) self.select_routineroom_frame() else: return
def timer(): #Updates and tracks time for the timer x = 0.00 if x >= 0.00: new_time = time.get() + 1 time.set(new_time) can.after(1000, timer) #call this function again in 1,000 milliseconds x += 1
def calculate_time(time): text = time.get('title') # this was the case when running witout the headless at lest match = re.search('(?P<dd>\d+)\/(?P<mm>\d+)\/(?P<yyyy>\d+)\s(?P<hh>\d+):(?P<m2>\d+)', text) match = re.search( '(?P<yyyy>\d+)-(?P<mm>\d+)-(?P<dd>\d+)\s(?P<hh>\d+):(?P<m2>\d+)', text) try: dd = int(match.group('dd')) mm = int(match.group('mm')) yyyy = int(match.group('yyyy')) hh = int(match.group('hh')) m2 = int(match.group('m2')) date_article = dt.datetime(yyyy, mm, dd, hh, m2) date_today = dt.datetime.today() diff = date_today - date_article time_elapsed = diff.days except Exception as exc: print("Notification: %s" % (exc)) print( "Something went wrong with the time conversion. The string that failed was {}" .format(text)) print("Setting time to 0") time_elapsed = 0 return time_elapsed
def buttonAddDef(): ''' Кнопка ДОБАВИТЬ ''' #print (message.get()) listbox.insert(END, time.get()[0:5].strip() + ' ' + message.get().strip()) print(listbox.get(0, END)[0])
def buttonChangeDef(): ''' Кнопка ИЗМЕНИТЬ ''' listbox.insert(listbox.curselection(), time.get()[0:5].strip() + ' ' + message.get().strip()) listbox.delete(listbox.curselection())
def take_effect(time: Dict, message: Dict, token: str, message_id: str) -> schedule.Job: """ 使消息生效,如果没有指明interval_count、interval_unit则立即生效 :param time: :param message: :param token: :return: 只有在时间单位为days、hours、minutes三者时,才允许调用at函数 * 如果为days,at的格式为HH:MM:SS或者HH:MM * 如果为hours,at的格式为:MM * 如果为minutes,at的格式为:SS """ interval_count = time.get("interval_count") if interval_count == 0: logger.info("立即生效") send_message(message, token) return interval_unit = time["interval_unit"] if interval_unit not in interval_list: logger.info("interval unit not found") send_message(message, token) return job = schedule.every(interval_count) job = getattr(job, interval_unit) # 此处调用schedule的一个函数 time = time.get("clock") # HH:MM:SS, HH:MM,`:MM`, :SS. if time in ("days", "hours", "minutes"): h, m, s = time.split(":") if time == "hours": time = f"{m}:{s}" elif time == "minutes": time = f":{s}" job = job.at(time) elif time in ("seconds"): # 如果时间单位是seconds,那么没必要at pass else: job.at(time) if interval_count == 0: message["run_times"] = 1 logger.info(f"message take effect {message}") job.do(send_message, message, token) if message_id in job_dict: remove_job_by_id(message_id) job_dict[message_id] = job return job
def gettext(souptext ,filename): entries = [] entry = [] for div in souptext.find_all('div'): if(div.get('class') != None and div.get('class')[0] == 'comment'): # A single post is referred to as a comment. Each comment is a block denoted in a div tag which has a class called comment. ps = div.find_all('p') #gets the message / body of the post aas = div.find_all('a') # gets the name of the person posting spans = div.find_all('span') # concat_str1 = '' for a in aas: if (a.get('class') != None and a.get('class')[0] == ''): for str in a.contents: if str != "<br>" or str != "<br/>": concat_str1 = (str.encode('utf-8')).strip() #entry.append(concat_str) rate = a.next_sibling.next_sibling star = rate['class'][0] concat_str2 = star.replace("allstar","") #entry.append(star.replace("allstar","")) concat_str3 = '' for time in spans: if (time.get('class') != None and time.get('class')[0] == ''): for str in time.contents: if str != "<br>" or str != "<br/>": concat_str3 = (str.encode('utf-8')).strip() #entry.append(concat_str) concat_str4 = '' usefulness = div.find_all("span", "votes pr5")[0] for str in usefulness.contents: concat_str4 = (str.encode('utf-8')).strip() #entry.append(concat_str) concat_str5 = '' for str in ps: concat_str5 = (str.get_text().encode('utf-8')).strip() if concat_str2=='': concat_str2='Null' entry.append(concat_str1+'\t'+concat_str2+'\t'+concat_str3+'\t'+concat_str4+'\t'+concat_str5) entries.append(entry) with open(filename,'a') as output: writer = csv.writer(output, delimiter= '\n', lineterminator = '\n') writer.writerows(entries)
def __init__(self): self.year=get()[0] self.month=get()[1] self.date=get()[2] self.hour=get()[3] self.minute=get()[4] self.second=get()[5] self.string=''
def combine(i, time, meta): # print "%d, %s: %f to %f" % (i, time.get("name"), time.get("start"), time.get("end")) audio, freq = audioParseSelection(i, time.get("start"), time.get("end")) if time.get("name") in meta.keys() and len(audio) > 0: time.update(meta.get(time.get("name"))) time.update({"conv_id": i, "freq": freq}) # print time, str(audio)[:100] time.update({"wav": audio, "nframes": len(audio)}) return time else: print "data not found:", time.get("name"), time.get("start"), time.get( "end"), len(audio)
def addTask(name, date, time): name = name.get() date = date.get() time = time.get() f = open('[location]\\tasks\\task.txt', 'a') try: timeCalculator(date, time) if '/' not in date and ':' not in time: print('Invalid Format') Label(root, text="(!) Invalid Entry", justify=RIGHT, bg='white', fg='#fc0324').grid(row=3, column=4) else: dt = date.split('/') dt[0] = int(dt[0]) dt[1] = int(dt[1]) tm = time.split(':') tm[0] = int(tm[0]) tm[1] = int(tm[1]) if dt[0] > 0 and dt[0] <= 31 and dt[1] > 0 and dt[1] <= 12 and tm[ 0] > 0 and tm[0] <= 24 and tm[1] > 0 and tm[ 1] <= 59 and timeCalculator(date, time) > 0: f.write(f'{name}\n') f.write(f'{date}\n') f.write(f'{time}\n^_^') f.close() print('\nEntry Added') showTask() elif timeCalculator(date, time) < 0: Label(root, text="(!) Time Already Passed", justify=RIGHT, bg='white', fg='#fc0324').grid(row=3, column=4) else: print('Invalid Format') Label(root, text="(!) Invalid Entry", justify=RIGHT, bg='white', fg='#fc0324').grid(row=3, column=4) except: Label(root, text="(!) Invalid Entry", justify=RIGHT, bg='white', fg='#fc0324').grid(row=3, column=4)
def get_post_info(urls): browser = webdriver.Chrome() post_details = [] i = 0 for link in urls: soup = connexion(link, browser) jaime = soup.find_all('meta', attrs={'name': 'description'}) time = soup.find("time") date = time.get('datetime') htags = get_htag(soup) i += 1 if i == 1: break post_details.append({'jaime': jaime, 'date': date, 'htags': htags})
def stringout(self): self.year=get()[0] self.month=get()[1] self.date=get()[2] self.hour=get()[3] self.minute=get()[4] self.second=get()[5] self.string = str(self.month)+'/'+str(self.date)+'/'+str(self.year)+' '+str(self.hour)+':'+str(self.minute)+':'+str(self.second) return self.string
def filenamegen(self): self.year=get()[0] self.month=get()[1] self.date=get()[2] self.hour=get()[3] self.minute=get()[4] self.second=get()[5] filename = str(self.month)+'_'+str(self.date)+'_'+str(self.year) return filename
def time(self): self.year=get()[0] self.month=get()[1] self.date=get()[2] self.hour=get()[3] self.minute=get()[4] self.second=get()[5] time = str(self.hour)+':'+str(self.minute)+':'+str(self.second) return time
def run(self): time = self.showTime() hour = time.get('hour') min = time.get('min') sec = time.get('sec') if 22 >= hour >= 8 and min == 0 and self.tellTime != hour: self.playTellTime(hour) if self.tellTime == hour and min == 0 and sec >= 4: pygame.mixer.quit() # if ("%02d:%02d:%02d" % (hour, min, sec)) == self.__alarm_time: # self.__alarm_beep_status = True # self.__alarm_beep_times = 0 if self.__alarm_beep_status and self.__alarm_beep_times > 30: self.SAKS.buzzer.off() self.__alarm_beep_status = False self.__alarm_beep_times = 0 if hour > 21 or (-1 < hour < 7): self.SAKS.ledrow.off() [self.SAKS.ledrow.on_for_index(leds) for leds in range(sec % 8)] else: self.SAKS.ledrow.off()
def update(self): self.year=get()[0] self.month=get()[1] self.date=get()[2] self.hour=get()[3] self.minute=get()[4] self.second=get()[5] return [self.year,self.month, self.date,self.hour, self.minute,self.second]
def ref(): a = str(sharename.get()) sharename.set(a) print a b = code(a) print b c = str(time.get()) time.set(c) print c l = linereg(a, c) lr.set(l[0]) lrerr.set(l[1]) cp.set(b) svm_1 = svmalgo(a, c) svm.set(svm_1[0]) svmerr.set(svm_1[1]) status = nws(a) na.set(status)
def depart_date(self, node): time = self.el.pop() self.add_meta("date", time.get("datetime", time.text))
def ok(): root.time = int(time.get()) root.current_time = root.time top.destroy()
def get_movie_info(url): # Get page scraper = cfscrape.create_scraper() full_url = "https://www.rottentomatoes.com" + url html = scraper.get(full_url).text soup = BeautifulSoup(html, 'html.parser') # Get title title_meta = soup.find("meta", property="og:title") title = title_meta['content'] # Get Tomato Score and Audience Score rating_box = soup.find("section", {"class": "mop-ratings-wrap__row"}) tomato = rating_box.find("span", { "class": "mop-ratings-wrap__percentage" }).text.strip() audience = rating_box.find("div", { "class": "mop-ratings-wrap__half audience-score" }).find("span", { "class": "mop-ratings-wrap__percentage" }).text.strip() tomato_score = ''.join([i for i in tomato if i.isdigit()]) audience_score = ''.join([i for i in audience if i.isdigit()]) # Get Cast cast_area = soup.find("div", {"class": "castSection"}) names = cast_area.find_all("div", {"class": "media-body"}) cast_list = [' '.join((name.find("span").text).split()) for name in names] # Get Rating, Genre, Director(s), Release Date, Runtime, Studio info = soup.find("div", {"class": "media-body"}) elements = info.find_all("li", {"class": "meta-row clearfix"}) infodict = {} for x in elements: for y in x.find_all("div", {"class": "meta-value"}): time = y.find("time") if time is not None: infodict[x.div.text] = time.get("datetime") else: infodict[x.div.text] = y.text.strip() # Clean up whitespace in genre, director infodict['Genre: '] = ' '.join(infodict['Genre: '].split()) infodict['Directed By: '] = ' '.join(infodict['Directed By: '].split()) # Remove unecessary info in rating infodict['Rating: '] = re.sub(r'\([^)]*\)', '', infodict['Rating: ']) # Isolate numbers in runtime infodict['Runtime: '] = ''.join( [i for i in infodict['Runtime: '] if i.isdigit()]) # Determine release date release_date = math.nan if 'In Theaters: ' in infodict: release_date = parse(infodict['In Theaters: ']) elif 'On Disc/Streaming: ' in infodict: release_date = parse(infodict['On Disc/Streaming: ']) # Final list of values ret_list = [ title, tomato_score, audience_score, release_date, infodict['Runtime: '], infodict['Rating: '], infodict['Genre: '].split(', '), cast_list, infodict['Studio: '], infodict['Directed By: '].split(', ') ] return ret_list
def podatki_filma(root): """Poisce podatke:""" str_budget = str_gross = str_meta = False str_genre = str_rating = str_duration = str_drzava = str_review = str_critics = str_naslov = '' # OSNOVNI PODATKI META = root.findall(".//meta[@content]")#[5].get("content") ## naslov in letnica for meta in META: str_naslov = meta.get("content") #if re.search("[0-9]{4}", str_naslov): break if meta.get("property") == "og:title": str_naslov = meta.get("content") break else: str_naslov = "None"#################### DIV = root.findall(".//div[@title]")#[0].get("title") ## rating, st_users for div in DIV: str_rating = div.get("title") if re.match("Users", str_rating): break else: str_rating = '' span = root.findall(".//span[@itemprop]") ## st_review, st_critic, genre for s in span: if s.get("itemprop") == "reviewCount": str_review = str_review + s.text + "\n" elif s.get("itemprop") == "genre": str_genre += (' ' + s.text) # !!! append !!! TIME = root.findall(".//time[@itemprop]")# runtime...kaj naredi, ce je vec runtimov? for time in TIME: if time.get("itemprop") == "duration": str_duration = time.text break DIV=root.findall(".//div[@class]") # print len(DIV) for div in DIV: ## budget, gross, drzava(pri release date) if div.get("class") == "txt-block": for child in div: if child.tag == "h4": if child.text == "Budget:": str_budget = child.tail elif child.text == "Gross:": str_gross = child.tail break A=root.findall(".//a[@href]") # metascore, nr_metcritics str_meta = '' for a in A: if a.get("href") == "criticreviews?ref_=tt_ov_rt": str_meta = str_meta + a.text if re.match("/country/", a.get("href") ): # se spreminja!!! str_drzava = a.text #naslov, letnica = re.split("\(", str_naslov) naslov = re.sub(" \([0-9]{4}\)", '', str_naslov) try: letnica = re.search("[0-9]{4}", str_naslov).group(0) except AttributeError: #letnica = "None" letnica = "0" if len(str_rating) != 0 and re.search("[0-9]+", str_rating): str_rating = re.split(" ", str_rating) rating = re.split("/", str_rating[3])[0] nr_users = re.sub("\(", "", str_rating[4]) #else: rating = nr_users = "None" else: rating = nr_users = "0" if len(str_duration) != 0: duration = re.sub(" min|\s", "", str_duration) #else: duration = "None" else: duration = "0" if len(str_drzava) != 0: drzava = re.sub("\s", '', str_drzava)#re.sub(" min", "", str_duration) else: drzava = "None" if len(str_genre) != 0: genre = re.split(" ", str_genre)[1] else: genre = "None" # Tole bo treba preuredit... Ne smem samo zavreci, temvec ohranit valuto in jo convertat if str_budget != False: #print str_budget #budget = re.sub("€|$|[a-zA-Z]+|\(|,|\)|\s", "", str_budget) budget = convert(str_budget) #else: budget = "None" else: budget = "0" if str_gross != False: #print str_gross #gross = re.sub("€|$|[a-zA-Z]+|\(|,|\)|\s", "", str_gross) gross = convert(str_gross) #else: gross = "None" else: gross = "0" if len(str_review) != 0: review = re.split(" ", str_review) nr_reviews = review[0] nr_critics = re.split("\n", review[1])[1] #nr_reviews = re.split(" ", str_review)[0] else: #nr_reviews = "None"#nr_critics = "None" nr_critics = nr_reviews = "0" if str_meta != False and len(str_meta) > 2: # print str_meta #if len(str_meta) > 2: # print str_meta str_meta = re.split("\n", str_meta) metascore = re.sub("\s", "", re.split("/", str_meta[0])[0] ) nr_metacritic = re.sub("\s", "", str_meta[1]) #print metascore, nr_metacritic else: metascore = nr_metacritic = "None" # uredit moram se naslov - krajsi od 30 znakov naslov = naslov[:30] naslov = re.sub("[\"|']", "#", naslov) #print naslov 0, letnica 1, str_drzava 2, duration 3, genre 4, rating 5, nr_users 6, budget 7, gross 8, nr_reviews 9, nr_critics 10, metascore 11, nr_metacritic 12 return naslov.encode('UTF-8'), letnica.encode('UTF-8'), drzava.encode('UTF-8'), duration.encode('UTF-8'), genre.encode('UTF-8'), rating.encode('UTF-8'), nr_users.encode('UTF-8'), budget.encode('UTF-8'), gross.encode('UTF-8'), nr_reviews.encode('UTF-8'), nr_critics.encode('UTF-8'), metascore.encode('UTF-8'), nr_metacritic.encode('UTF-8')
def retrieve_from_xml_fare(xmldoc): """Retrieves some parameters from the XML text for a faremelding specified by xmldoc and returns them as a list of values.""" locations = [] res = {} root = fromstring(xmldoc) sender = None #dangerwarning spesific id = "BLANK" #dangerwarning spes# ific mnr = None #dangerwarning spesific alert = None #dangerwarning spesific t = root.find('dangerwarning') # new types of warnings using metfare template and <dangerwarning> tag. if t is not None and len(t) > 1: alert = t.find( 'msgtype').text # all this stuff is common to the whole CAP-file mnr = t.find('msgnumber').text references = t.find('msgreferences').text id = t.find('msgidentifier').text header = root.find('productheader') if header is not None: res['phenomenon_type'] = header.findtext('phenomenon_type') res['phenomenon_name'] = header.findtext('phenomenon_name') res['phenomenon_number'] = header.findtext('phenomenon_number') p = root.find('productdescription') if p is not None: termin = p.get('termin') for time in root.iter('time'): vto = time.get('vto') vfrom = time.get('vfrom') for f in time.iter('forecasttype'): forecasttype = f.get('name') for location in f.iter('location'): #print(forecasttype) res['forecasttype'] = forecasttype loc = {} loc['id'] = location.get('id') loc['all_ids'] = location.get('all_ids') loc['name'] = location.find('header').text for param in location.findall('parameter'): nam = param.get('name') temp = param.find('in') value = "\n".join(temp.itertext()) loc[nam] = value loc['vfrom'] = vfrom loc['vto'] = vto loc['effective'] = vfrom locations.append(loc) res['locations'] = locations res['termin'] = termin res['id'] = id res['mnr'] = mnr res['alert'] = alert res['references'] = references return res # res is all the info just obtained from the Ted document
def sendMailLater(): senderFinal = myMail.get() passwordFinal = password.get() recieverFinal = otherMail.get() subjectFinal = subject.get() bodyFinal = body.get("1.0", END) dateFinal = date.get() timeFinal = time.get() window.destroy() window2.destroy() window3.destroy() try: x = sendEmailInTime(senderFinal, passwordFinal, recieverFinal, subjectFinal, bodyFinal, getFile.fileName, dateFinal, timeFinal) except: x = sendEmailInTime(senderFinal, passwordFinal, recieverFinal, subjectFinal, bodyFinal, '0', dateFinal, timeFinal) if (x == 'dateFormat'): lll.pack_forget() ll.pack_forget() l.pack_forget() MailSentLabel = Label( topFrame, text="you you have entered a wrong date format") MailSentLabel.config(foreground='#8BD8BD', background='#243665', font=('times', 30, 'bold')) MailSentLabel.pack() thankYouLabel = Label(topFrame, text="email not sent") thankYouLabel.config(foreground='#8BD8BD', background='#243665', font=('times', 30, 'bold')) thankYouLabel.pack() seeYouLabel = Label(topFrame, text="please try again") seeYouLabel.config(foreground='#8BD8BD', background='#243665', font=('times', 30, 'bold')) seeYouLabel.pack() elif (x == 'timeFormat'): lll.pack_forget() ll.pack_forget() l.pack_forget() MailSentLabel = Label( topFrame, text="you you have entered a wrong time format") MailSentLabel.config(foreground='#8BD8BD', background='#243665', font=('times', 30, 'bold')) MailSentLabel.pack() thankYouLabel = Label(topFrame, text="email not sent") thankYouLabel.config(foreground='#8BD8BD', background='#243665', font=('times', 30, 'bold')) thankYouLabel.pack() seeYouLabel = Label(topFrame, text="please try again") seeYouLabel.config(foreground='#8BD8BD', background='#243665', font=('times', 30, 'bold')) seeYouLabel.pack() elif (x == 'past'): lll.pack_forget() ll.pack_forget() l.pack_forget() root.geometry("1000x300") MailNotSentLabel = Label( topFrame, text= "“You can't go back and change the beginning,but you") MailNotSentLabel.config(foreground='#8BD8BD', background='#243665', font=('times', 30, 'bold')) MailNotSentLabel.pack() MailNotSentLabel = Label( topFrame, text="can start where you are and change the ending.”") MailNotSentLabel.config(foreground='#8BD8BD', background='#243665', font=('times', 30, 'bold')) MailNotSentLabel.pack() seeYouLabel = Label(topFrame, text="― C. S. Lewis") seeYouLabel.config(foreground='#8BD8BD', background='#243665', font=('times', 30, 'bold')) seeYouLabel.pack() seeYouLabel = Label( topFrame, text="we are sorry we can not do anything the past time" ) seeYouLabel.config(foreground='#8BD8BD', background='#243665', font=('times', 30, 'bold')) seeYouLabel.pack() seeYouLabel = Label( topFrame, text= "please try again and enter a date and time in the future" ) seeYouLabel.config(foreground='#8BD8BD', background='#243665', font=('times', 30, 'bold')) seeYouLabel.pack() elif (x == 'notSent'): lll.pack_forget() ll.pack_forget() l.pack_forget() MailNotSentLabel = Label(topFrame, text="mail not sent") MailNotSentLabel.config(foreground='#8BD8BD', background='#243665', font=('times', 30, 'bold')) MailNotSentLabel.pack() seeYouLabel = Label( topFrame, text="please check the entered data and try again") seeYouLabel.config(foreground='#8BD8BD', background='#243665', font=('times', 30, 'bold')) seeYouLabel.pack() elif (x == 'sent'): lll.pack_forget() ll.pack_forget() l.pack_forget() MailSentLabel = Label(topFrame, text="mail sent successfully") MailSentLabel.config(foreground='#8BD8BD', background='#243665', font=('times', 30, 'bold')) MailSentLabel.pack() thankYouLabel = Label( topFrame, text="thank you for using our program") thankYouLabel.config(foreground='#8BD8BD', background='#243665', font=('times', 30, 'bold')) thankYouLabel.pack() seeYouLabel = Label(topFrame, text="see you") seeYouLabel.config(foreground='#8BD8BD', background='#243665', font=('times', 30, 'bold')) seeYouLabel.pack()
def handle_go_straight_for_seconds(mqtt_sender, time, speed): print('Straight for seconds:', time.get(), 'At speed:', speed.get()) mqtt_sender.send_message('straight_for_seconds', [time.get(), speed.get()])
def handle_straight_seconds_time(time, speed, mqtt_sender): print('go straight for inches using time', time.get(), speed.get()) mqtt_sender.send_message('go_straight_for_inches_using_time', [time.get(), speed.get()])