SHARE
TWEET

Untitled

a guest Jul 19th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. frame = Frame(mainWindow) # фрейм в котором будет расположен столбец фреймов с скроллом
  2. frame.grid()
  3. listbox = Listbox(dialogsFrame)
  4. listbox.pack(side = LEFT, fill = Y)
  5. scroll = Scrollbar(dialogsFrame)
  6. scroll.pack(side = RIGHT, fill = Y)
  7. listbox.config(yscrollcommand = scroll.set)
  8. scroll.config(command = listbox.yview)
  9.      
  10. from tkinter import *
  11.  
  12. root = Tk()
  13.  
  14. topButton = Button(root, text = 'Кнопка сверху')
  15. topButton.grid(row = 0, column = 0)
  16. lowFrame = Frame(root)
  17. lowFrame.grid(row = 1, column = 0)
  18.  
  19. canvas = Canvas(lowFrame)
  20. frame = Frame(canvas)
  21. myscrollbar = Scrollbar(lowFrame, orient = 'vertical', command = canvas.yview)
  22. canvas.configure(yscrollcommand = myscrollbar.set)
  23. myscrollbar.pack(side = 'right', fill = Y)
  24. canvas.pack(side = 'left')
  25. canvas.create_window((0, 0), window = frame, anchor = 'nw')
  26. def conf(event):
  27.     canvas.configure(scrollregion = canvas.bbox('all'))
  28. frame.bind('<Configure>', conf)
  29.  
  30. for i in range(50):
  31.     b = Button(frame, text = str(i))
  32.     b.grid(row = i, column = 0)
  33.  
  34. root.mainloop()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top