Добрый вечер.
Совсем уже измучался. Создаю прогу, в которой есть авторизация ВК. Юзаю libVK от dimka665. Всё бы хорошо, но я кое-чего не догоняю. Есть код:
#!/usr/bin/env python3
import curses
import vk
#Start ncurses window
global stdscr
stdscr = curses.initscr()
curses.noecho()
curses.cbreak()
stdscr.keypad(True)
def Close(): #Close the window
curses.nocbreak()
stdscr.keypad(False)
curses.echo()
def Clear(): #Clear NCurses window
stdscr.clear()
stdscr.refresh()
curses.endwin()
def VKLogin(): #Start VK session
#Get login
from curses.textpad import Textbox, rectangle
stdscr.addstr(0, 0, "Enter your VK login: (Ctrl-G/Enter to continue, Ctrl+H to delete symbols)")
editwin = curses.newwin(1,30, 2,1)
rectangle(stdscr, 1,0, 1+1+1, 1+30+1)
stdscr.refresh()
box = Textbox(editwin)
box.edit() #Let the user edit until Ctrl-G is struck
login = str(box.gather())
#Clear window
Clear()
#Get password
stdscr.addstr(0, 0, "Enter your VK password: (Ctrl-G/Enter to continue, Ctrl+H to delete symbols)")
editwin = curses.newwin(1,30, 2,1)
stdscr.refresh()
rectangle(stdscr, 1,0, 1+1+1, 1+30+1)
stdscr.refresh()
box = Textbox(editwin)
box.edit() #Let the user edit until Ctrl-G is struck
stdscr.clear()
password = str(box.gather())
#Clear window
Clear()
curses.endwin()
#Start session with collected data
session = vk.AuthSession(app_id = 5350360, user_login = login, user_password = password)
api = vk.API(session, v = '5.3.5', lang = 'ru', timeout=10)
#api.users.get(user_ids=1)
def Menu(): #Navigation menus
from curses import panel
stdwin = curses.newwin()
#TODO
#Menu()
VKLogin()
Close()
#TODO: menu, authorization
Вопрос прост: ЧЯДНТ?