#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from tkinter import *

# on crée la fenêtre principale
fenetre = Tk()
fenetre.rowconfigure(0, weight=1)

canvas = Canvas(fenetre, bg="white", width=200, height=100)
canvas.create_text(100, 50, text="Hello good people!")
canvas.grid(row=0, column=0, sticky=NW+SE)

vbar = Scrollbar(fenetre, orient=VERTICAL)
vbar.grid(row=0, column=1, sticky=NS)

# connexion canvas - scrollbar

canvas.configure(
    yscrollcommand=vbar.set,
    scrollregion=(0, 0, 200, 300),
)

vbar.configure(command=canvas.yview)

# on lance la boucle principale
fenetre.mainloop()
