7 октября 2019
AndreyТолько на этот раз добавляй новые значения
Сделал ключом идентификатор, к-ый не требует никаких манипуляций и таскаю его везде. В итоге получилось то что хотел и сократил код аж на 20 строчек. Спасибо за помощь!
AnastasiaЗдравствуйте,
Ребята, кто работал с tkinter
Есть Spinbox. Принимает значения от 0 до 360, крутится, только если нажимать на верхнюю стрелочку. То есть 0, 1, 2...
Как сделать так, чтоб крутился и в обратную, т.е. 0, 360, 359...
Там прикол в том, что Spinbox не предоставляет никакого интерфейса для обработки нажатий кнопок вверх и вниз (по отдельности), список, передаваемый в values тупо копируется внутри самого класса, поэтому изменить его неполучится. Короче лично я без понятия как это осуществить, проще свой Spinbox написать)
def test():
dic = {'Type': 'movie', 'Title': 'Deadpool 2', 'Year': '2018', 'Rated': 'R', 'Released': '18 May 2018', 'Runtime': '119 min', 'Genre': 'Action, Adventure, Comedy, Sci-Fi', 'Director': 'David Leitch', 'Writer': 'Rhett Reese, Paul Wernick, Ryan Reynolds', 'Actors': 'Ryan Reynolds, Josh Brolin, Morena Baccarin, Julian Dennison', 'Plot': 'Foul-mouthed mutant mercenary Wade Wilson (AKA. Deadpool), brings together a team of fellow mutant rogues to protect a young boy with supernatural abilities from the brutal, time-traveling cyborg, Cable.', 'Language': 'English, Cantonese, Spanish, Russian', 'Country': 'USA', 'Awards': 'N/A', 'Poster': 'https://m.media-amazon.com/images/M/MV5BNjk1Njk3YjctMmMyYS00Y2I4LThhMzktN2U0MTMyZTFlYWQ5XkEyXkFqcGdeQXVyODM2ODEzMDA@._V1_SX300.jpg', 'Ratings': [{'Source': 'Internet Movie Database', 'Value': '7.8/10'}, {'Source': 'Rotten Tomatoes', 'Value': '83%'}, {'Source': 'Metacritic', 'Value': '66/100'}], 'Metascore': '66', 'imdbRating': '7.8', 'imdbVotes': '311,435', 'imdbID': 'tt5463162', 'DVD': '21 Aug 2018', 'BoxOffice': 'N/A', 'Production': '20th Century Fox', 'Website': 'https://www.foxmovies.com/movies/deadpool-2', 'Response': 'True'}
ratings = dic['Ratings']
sourses_list = []
for sources in ratings:
if 'Rotten Tomatoes' not in sources.items():
return 0
else:
for k,v in sources.items():
if "%" in v:
return int(str(v[:2]))
print(test())
def test():
dic = {'Type': 'movie', 'Title': 'Deadpool 2', 'Year': '2018', 'Rated': 'R', 'Released': '18 May 2018', 'Runtime': '119 min', 'Genre': 'Action, Adventure, Comedy, Sci-Fi', 'Director': 'David Leitch', 'Writer': 'Rhett Reese, Paul Wernick, Ryan Reynolds', 'Actors': 'Ryan Reynolds, Josh Brolin, Morena Baccarin, Julian Dennison', 'Plot': 'Foul-mouthed mutant mercenary Wade Wilson (AKA. Deadpool), brings together a team of fellow mutant rogues to protect a young boy with supernatural abilities from the brutal, time-traveling cyborg, Cable.', 'Language': 'English, Cantonese, Spanish, Russian', 'Country': 'USA', 'Awards': 'N/A', 'Poster': 'https://m.media-amazon.com/images/M/MV5BNjk1Njk3YjctMmMyYS00Y2I4LThhMzktN2U0MTMyZTFlYWQ5XkEyXkFqcGdeQXVyODM2ODEzMDA@._V1_SX300.jpg', 'Ratings': [{'Source': 'Internet Movie Database', 'Value': '7.8/10'}, {'Source': 'Rotten Tomatoes', 'Value': '83%'}, {'Source': 'Metacritic', 'Value': '66/100'}], 'Metascore': '66', 'imdbRating': '7.8', 'imdbVotes': '311,435', 'imdbID': 'tt5463162', 'DVD': '21 Aug 2018', 'BoxOffice': 'N/A', 'Production': '20th Century Fox', 'Website': 'https://www.foxmovies.com/movies/deadpool-2', 'Response': 'True'}
ratings = dic['Ratings']
for sources in ratings:
if 'Rotten Tomatoes' not in sources.items():
return 0
else:
for k,v in sources.items():
if "%" in v:
return int(str(v[:2]))
print(test())
Ссылка
нажмите — покажем
нажмите — покажем
Народ, а как тут https://github.com/MaxValue/Terpene-Profile-Parser-for-Cannabis-Strains надо запускать? И что?
У def test(): dic = {'Type': 'movie', 'Title': 'Deadpool 2', 'Year': '2018', 'Rated': 'R', 'Released': '18 May 2018', 'Runtime': '119 min', 'Genre': 'Action, Adventure, Comedy, Sci-Fi', 'Director': 'David Leitch', 'Writer': 'Rhett Reese, Paul Wernick, Ryan Reynolds', 'Actors': 'Ryan Reynolds, Josh Brolin, Morena Baccarin, Julian Dennison', 'Plot': 'Foul-mouthed mutant mercenary Wade Wilson (AKA. Deadpool), brings together a team of fellow mutant rogues to protect a young boy with supernatural abilities from the brutal, time-traveling cyborg, Cable.', 'Language': 'English, Cantonese, Spanish, Russian', 'Country': 'USA', 'Awards': 'N/A', 'Poster': 'https://m.media-amazon.com/images/M/MV5BNjk1Njk3YjctMmMyYS00Y2I4LThhMzktN2U0MTMyZTFlYWQ5XkEyXkFqcGdeQXVyODM2ODEzMDA@._V1_SX300.jpg', 'Ratings': [{'Source': 'Internet Movie Database', 'Value': '7.8/10'}, {'Source': 'Rotten Tomatoes', 'Value': '83%'}, {'Source': 'Metacritic', 'Value': '66/100'}], 'Metascore': '66', 'imdbRating': '7.8', 'imdbVotes': '311,435', 'imdbID': 'tt5463162', 'DVD': '21 Aug 2018', 'BoxOffice': 'N/A', 'Production': '20th Century Fox', 'Website': 'https://www.foxmovies.com/movies/deadpool-2', 'Response': 'True'} ratings = dic['Ratings'] for sources in ratings: if 'Rotten Tomatoes' not in sources.keys(): return 0 else: for k,v in sources.items(): if "%" in v: return int(str(v[:2])) print(test())
def test():
dic = {'Type': 'movie', 'Title': 'Deadpool 2', 'Year': '2018', 'Rated': 'R', 'Released': '18 May 2018', 'Runtime': '119 min', 'Genre': 'Action, Adventure, Comedy, Sci-Fi', 'Director': 'David Leitch', 'Writer': 'Rhett Reese, Paul Wernick, Ryan Reynolds', 'Actors': 'Ryan Reynolds, Josh Brolin, Morena Baccarin, Julian Dennison', 'Plot': 'Foul-mouthed mutant mercenary Wade Wilson (AKA. Deadpool), brings together a team of fellow mutant rogues to protect a young boy with supernatural abilities from the brutal, time-traveling cyborg, Cable.', 'Language': 'English, Cantonese, Spanish, Russian', 'Country': 'USA', 'Awards': 'N/A', 'Poster': 'https://m.media-amazon.com/images/M/MV5BNjk1Njk3YjctMmMyYS00Y2I4LThhMzktN2U0MTMyZTFlYWQ5XkEyXkFqcGdeQXVyODM2ODEzMDA@._V1_SX300.jpg', 'Ratings': [{'Source': 'Internet Movie Database', 'Value': '7.8/10'}, {'Source': 'Rotten Tomatoes', 'Value': '83%'}, {'Source': 'Metacritic', 'Value': '66/100'}], 'Metascore': '66', 'imdbRating': '7.8', 'imdbVotes': '311,435', 'imdbID': 'tt5463162', 'DVD': '21 Aug 2018', 'BoxOffice': 'N/A', 'Production': '20th Century Fox', 'Website': 'https://www.foxmovies.com/movies/deadpool-2', 'Response': 'True'}
ratings = dic['Ratings']
for sources in ratings:
if 'Rotten Tomatoes' not in sources.items():
return 0
else:
for k,v in sources.items():
if "%" in v:
return int(str(v[:2]))
print(test())