Merhaba iyi forumlar herkese,
Programda ekranda aktif olan tablo da satır sayısı arttığı zaman scrollbar ile aşağı inmek istiyorum. Pencere boyutu aynı kalacak şekilde bunu yapmak istedim. Fakat scrollbar’ı bir türlü ekleyemiyorum. Tkinter derslerinde scrollbar’ı text alanı içerisine eklemeyi öğrendim. Orada yaptıklarımı direk pencereye uyarlamaya çalıştım fakat olmadı. Bu ekrana nasıl scrollbar ekleyebilirim?
Kod paylaşmam gerekiyorsa diye ekranı aktif eden kod şudur;
from tkinter import *
from function.program.information import start_information
import sqlite3
class Application(object):
def __init__(self):
self.main()
def main(self):
self.con = sqlite3.connect("database/database.db")
self.cursor = self.con.cursor()
self.cursor.execute("SELECT * FROM SINAV_DATA")
self.sinav_data = self.cursor.fetchall()
self.con.commit()
self.cursor.execute("SELECT TOTAL FROM SINAV_DATA")
self.total_data = self.cursor.fetchall()
self.con.commit()
self.con.close()
self.toplam = 0
for self.i in self.total_data:
self.toplam += self.i[0]
if len(self.sinav_data) == 0:
self.sinav_data = [(0,0,0)]
self.pencere1 = Tk()
self.pencere1.title(start_information.last_rapor_name_title)
self.pencere1.geometry("395x200+685+390")
self.pencere1.resizable(FALSE, FALSE)
self.cerceve1 = Frame(self.pencere1)
self.cerceve1.grid(row=0, column=0, padx=5)
# sütun
self.button1 = Button(self.pencere1, text="İŞLEM TARİHİ", width=14)
self.button1.grid(row=0, column=0)
self.button2 = Button(self.pencere1, text="TOPLAM", width=14)
self.button2.grid(row=0, column=1)
self.button3 = Button(self.pencere1, text="KAYIT TARİHİ", width=20)
self.button3.grid(row=0, column=2)
self.satir = 1
self.sutun = 0
self.first_index = 0
self.second_index = 0
self.eleman = len(self.sinav_data)
self.list_index = self.eleman - 1
self.durum = True
while self.durum:
self.etiket1 = Label(self.pencere1, width=16, text=self.sinav_data[self.first_index][self.second_index])
self.etiket1.grid(row=self.satir, column=self.sutun)
self.second_index += 1
self.sutun += 1
if self.second_index > 2 and self.sutun > 2:
self.second_index = 0
self.sutun = 0
self.first_index += 1
self.satir += 1
if self.first_index == self.eleman:
self.etiket1 = Label(self.pencere1, text="TOPLAM", font="Helvatica 14 bold")
self.etiket1.grid(row=self.satir, column=0)
self.etiket1 = Label(self.pencere1, text=self.toplam, font="Helvatica 14 bold")
self.etiket1.grid(row=self.satir, column=1)
self.durum = False
else:
print("Rapor Oluşturuluyor")