Skip to main content

scrollbar doesn't fill or appear. tkinter

I'm having trouble with my scrollbar. I tried something but each time I had a little trouble. now I can't even see the scrollbar, other times it doesn't fill the y-axis. firstly I tried without canvas, just with frame (allTelemtry) for using grid() but couldn't achieve it then tried with canvas so I can use pack() but still can't do it properly.

from tkinter import *
from tkinter import ttk

root = Tk()
root.state('zoomed')

# creating notebook
telemetry = ttk.Notebook(root, width=1083, height=200)
telemetry.place(x=440, y=560)

allTelemetry = Frame(telemetry)
allTelemetry.pack(fill="both", expand = 1)

# creating canvas for scrollbar 
allTelemetryCanvas = Canvas(allTelemetry)
allTelemetryCanvas.pack(fill="both", expand = 1)

dotTelemetry = Frame(telemetry)
dotTelemetry.pack(fill="both", expand = 1)

telemetry.add(allTelemetry, text= u"Hepsini Goster")
telemetry.add(dotTelemetry, text= u"Anlik Telemetri")

#------------------------------------------------------------
teleTitle = [" ", "Takmno","Paketno","Zaman",
        "1Basn","2Basn",
        "Nem",
        "1kseklik","2Ykseklik",
        "rtifaFark","niHz","Scaklk","PilGerilimi",
        "La1","Lo1","Al1",
        "La2","Lo2","Al2",
        "Drm",
        "x","y","z",
        "DnSays","Video"]

empty = Label(allTelemetryCanvas, text="",width=3)
empty.grid(row=0,column=0,padx=1, pady=1)
for j in range(1,25):
    teleTitle[j] = teleTitle[j].encode('UTF-8')

    entry = Label(allTelemetryCanvas,text=teleTitle[j].decode(),anchor='w', width=5, bd=2)
    entry.grid(row=0, column=j,padx=1, pady=1)

packet=1
for i in range(1,10):
    packetNum = Label(allTelemetryCanvas, text = packet, anchor="w",width=3)
    packetNum.grid(row=i, column=0,pady=0.5)
    packet = packet+1
    for j in range(1,25):
        takenData = Entry(allTelemetryCanvas,width=5)
        takenData.grid(row=i, column=j,pady=0.5)

# !!!!!!!!!!!!!!!!!
scrollbar = ttk.Scrollbar(allTelemetry, orient='vertical', command=allTelemetryCanvas.yview)
scrollbar.pack(side=RIGHT, fill="y")
allTelemetryCanvas['yscrollcommand'] = scrollbar.set


root.mainloop()


source https://stackoverflow.com/questions/72664385/scrollbar-doesnt-fill-or-appear-tkinter

Comments

Popular posts from this blog

Confusion between commands.Bot and discord.Client | Which one should I use?

Whenever you look at YouTube tutorials or code from this website there is a real variation. Some developers use client = discord.Client(intents=intents) while the others use bot = commands.Bot(command_prefix="something", intents=intents) . Now I know slightly about the difference but I get errors from different places from my code when I use either of them and its confusing. Especially since there has a few changes over the years in discord.py it is hard to find the real difference. I tried sticking to discord.Client then I found that there are more features in commands.Bot . Then I found errors when using commands.Bot . An example of this is: When I try to use commands.Bot client = commands.Bot(command_prefix=">",intents=intents) async def load(): for filename in os.listdir("./Cogs"): if filename.endswith(".py"): client.load_extension(f"Cogs.{filename[:-3]}") The above doesnt giveany response from my Cogs ...

How to show number of registered users in Laravel based on usertype?

i'm trying to display data from the database in the admin dashboard i used this: <?php use Illuminate\Support\Facades\DB; $users = DB::table('users')->count(); echo $users; ?> and i have successfully get the correct data from the database but what if i want to display a specific data for example in this user table there is "usertype" that specify if the user is normal user or admin i want to user the same code above but to display a specific usertype i tried this: <?php use Illuminate\Support\Facades\DB; $users = DB::table('users')->count()->WHERE usertype =admin; echo $users; ?> but it didn't work, what am i doing wrong? source https://stackoverflow.com/questions/68199726/how-to-show-number-of-registered-users-in-laravel-based-on-usertype

Why is my reports service not connecting?

I am trying to pull some data from a Postgres database using Node.js and node-postures but I can't figure out why my service isn't connecting. my routes/index.js file: const express = require('express'); const router = express.Router(); const ordersCountController = require('../controllers/ordersCountController'); const ordersController = require('../controllers/ordersController'); const weeklyReportsController = require('../controllers/weeklyReportsController'); router.get('/orders_count', ordersCountController); router.get('/orders', ordersController); router.get('/weekly_reports', weeklyReportsController); module.exports = router; My controllers/weeklyReportsController.js file: const weeklyReportsService = require('../services/weeklyReportsService'); const weeklyReportsController = async (req, res) => { try { const data = await weeklyReportsService; res.json({data}) console...