#-*- coding: utf-8 -*-
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.widget import Widget
from kivy.uix.label import Label
from kivy.uix.anchorlayout import AnchorLayout
from kivy.uix.boxlayout import BoxLayout
class myApp(App):
def build(self):
gl = BoxLayout(orientation = "vertical", padding=[200, 100], spacing=30)
self.lbl = Label(text = 'привет ты мальчик?', font_size = 50)
gl.add_widget(self.lbl)
gl.add_widget(Button(text = 'да', font_size = 30, background_color = [.32,.85,.94,1], on_press=self.update_label))
gl.add_widget(Button(text = 'нет', font_size = 30, background_color = [1 ,0 ,0, 1]))
return gl
def update_label(self, instance):
self.lbl.text = "Привет МАЛЬЧИК"
if __name__ =="__main__":
myApp().run()
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import vk_api
import urllib
LOGIN = 'ТВОЙ ЛОГИН'
PASSWORD = 'ТВОЙ ПАРОЛЬ'
def main():
# ======= Открываем сессию с VK =======
vk_session = vk_api.VkApi(LOGIN, PASSWORD)
try:
vk_session.auth()
except vk_api.AuthError as error_msg:
print(error_msg)
return
vk = vk_session.get_api()
# ======= считываем список пользователей =======
file_id = open(os.path.join(sys.path[0],'id_users.txt'), 'r')
data_list = file_id.readlines()
id_list = []
for line in data_list:
id_list.append(line.strip())
# ======= начинаем перебирать каждого пользователя =======
for id_user in id_list:
# создаем директорию с именем пользователя, если нет
newpath = os.path.join(sys.path[0], id_user)
if not os.path.exists(newpath):
os.makedirs(newpath)
# посылаем запрос к VK API, count свой, но не более 200
response = vk.photos.getAll(owner_id = int(id_user), count = 3)
# работаем с каждой полученной фотографией
for i in range(len(response["items"])):
# берём ссылку на максимальный размер фотографии
photo_url = str(response["items"][i]["sizes"][len(response["items"][i]["sizes"])-1]["url"])
# скачиваем фото в папку с ID пользователя
urllib.urlretrieve(photo_url, newpath + '/' + str(response["items"][i]['id']) + '.jpg')
if __name__ == "__main__":
main()
login, password = 'ВАШ_ЛОГИН', 'ВАШ_ПАРОЛЬ'
vk_session = vk_api.VkApi(login, password)
try:
vk_session.auth()
except vk_api.AuthError as error_msg:
print(error_msg)
return
vk = vk_session.get_api()
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import vk_api
def main():
login, password = 'LOGIN', 'PASSWORD'
vk_session = vk_api.VkApi(login, password)
try:
vk_session.auth()
except vk_api.AuthError as error_msg:
print(error_msg)
return
vk = vk_session.get_api()
response = vk.messages.removeChatUser(chat_id=ID_CHAT, user_id=ID_USER)
layout = BoxLayout(orientation='vertical')
btn1 = Button(text='Hello')
btn2 = Button(text='World')
layout.add_widget(btn1)
layout.add_widget(btn2)
for x in items.get('razdely'):
item = AccordionItem(title=x.get("text"))
#~ item.add_widget(Button(text="Кнопка N1"))
#~ item.add_widget(Button(text="Кнопка N2"))
#~ item.add_widget(layout)
layout = BoxLayout(orientation='vertical')
btn1 = Button(text='Hello')
btn2 = Button(text='World')
layout.add_widget(btn1)
layout.add_widget(btn2)
item.add_widget(layout)
root.add_widget(item)
upload = vk_api.VkUpload(vk_session)
foto = upload.photo('PATH/foto.jpg', album_id="id_альбома", group_id="id_группы")
vk_photo_url = 'https://vk.com/photo{}_{}'.format(foto[0]['owner_id'], foto[0]['id'])
photo.append(vk_photo_url.replace('https://vk.com/', ''))
# -*- coding: utf-8 -*-
import vk_api
def main():
login, password = 'ТВОЙ e'mail', 'ТВОЙ password'
vk_session = vk_api.VkApi(login, password)
try:
vk_session.auth()
except vk_api.AuthError as error_msg:
print(error_msg)
return
vk = vk_session.get_api()
response = vk.users.search(city =1)
print response
if __name__ == '__main__':
main()