ycliper

Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
Скачать

Why is my Tkinter canvas not allowing me to scroll all the way down after generating new widgets?

Автор: Emrah KAYA

Загружено: 2024-10-14

Просмотров: 4

Описание: Hello everyone! I hope this video has helped solve your questions and issues. This video is shared because a solution has been found for the question/problem. I create videos for questions that have solutions. If you have any other issues, feel free to reach out to me on Instagram:   / ky.emrah  

Below, you can find the text related to the question/problem. In the video, the question will be presented first, followed by the answers. If the video moves too fast, feel free to pause and review the answers. If you need more detailed information, you can find the necessary sources and links at the bottom of this description. I hope this video has been helpful, and even if it doesn't directly solve your problem, it will guide you to the source of the solution. I'd appreciate it if you like the video and subscribe to my channel!Why is my Tkinter canvas not allowing me to scroll all the way down after generating new widgets?

import tkinter as tk
from tkinter import *
from tkinter import ttk
from datetime import datetime
import ttkbootstrap as ttk
from ttkbootstrap import window
import pandas as pd
import calendar
import random
from tkinter import font
import tkinter.messagebox as tkmb




root = ttk.Window(themename="darkly")
root.title("shifts_scheduler")
w_int = root.winfo_screenwidth()
h_int = root.winfo_screenheight()

root.geometry(f"{w_int}x{h_int}")
root.update_idletasks()
root.resizable(True, True)

Create a canvas and a vertical scrollbar
canvas = ttk.Canvas(root, width=root.winfo_screenwidth(), height=root.winfo_screenheight())





Create a frame inside the canvas
master_window = ttk.Frame(master=canvas, )
master_window.bind(" Configure ", lambda e: on_frame_configure(canvas))

Pack the frame into the canvas and center it horizontally
canvas.create_window((root.winfo_screenwidth() // 2, 0), window=master_window, anchor="n")
canvas.grid(row=1, column=1, rowspan=6, padx=0, pady=0)
scrollbar = ttk.Scrollbar(master=root, orient="vertical", command=canvas.yview)
canvas.configure(yscrollcommand=scrollbar.set)
scrollbar.grid(column=1, row=0, sticky="ne")
root.grid_rowconfigure(0, weight=1)
root.grid_columnconfigure(0, weight=1)
canvas.bind(" Configure ", lambda e: on_frame_configure(canvas))

Track the entries in a dictionary keyed by the row number
max_entries = {}

worker_entries = []
workers_data = []
workers_list = []

def on_frame_configure(canvas):
Reset the scroll region to encompass the inner frame
canvas.configure(scrollregion=canvas.bbox("all"))

def max_box(mvar, row):
if mvar.get() == 1:
Create a new Entry widget for the given row
max_entry = ttk.Entry(master=generated_frame, font="Calibri 14")
max_entry.grid(row=row, column=7, padx=10, pady=10)
max_entries[row] = max_entry # Store it in the dictionary
else:
Destroy the entry if it exists and remove it from the dictionary
if row in max_entries:
max_entries[row].destroy()
del max_entries[row]

def is_weekend(date_str):
date_obj = datetime.strptime(date_str, '%d %m %Y')
day_num = date_obj.weekday() # 0 for Monday, 1 for Tuesday, ..., 6 for Sunday
return day_num = 5 # Returns True if it's Saturday or Sunday, indicating a weekend

def day_of_week(date_str):
date_obj = datetime.strptime(date_str, '%d %m %Y')
day_num = date_obj.weekday() # 0 for Monday, 1 for Tuesday, ..., 6 for Sunday
return day_num

def get_days_in_month(year_int, month):
return calendar.monthrange(year_int, month)[1]

def generate_workers():
global worker_entries # Declare global at the start of the function
number_workers = workers_int.get()


Destroy all previous widgets in the generated frame
for widget in generated_frame.winfo_children():
widget.destroy()

Reset the max_entries dictionary and worker names list
max_entries.clear()
worker_entries.clear() # Clear the list to avoid old entries
workers_data.clear()
workers_list.clear() # Clear the worker data list
Clear the worker data list

Generate labels and entries for each worker
tested_label = ttk.Label(master=generated_frame, text="✔", font="Calibri 21")
untested_label = ttk.Label(master=generated_frame, text="❌", font="Calibri 15")
name_labelSource of the question:
https://stackoverflow.com/questions/7...

Question and source license information:
https://meta.stackexchange.com/help/l...
https://stackoverflow.com/

Не удается загрузить Youtube-плеер. Проверьте блокировку Youtube в вашей сети.
Повторяем попытку...
Why is my Tkinter canvas not allowing me to scroll all the way down after generating new widgets?

Поделиться в:

Доступные форматы для скачивания:

Скачать видео

  • Информация по загрузке:

Скачать аудио

Похожие видео

И ТАКИЕ ЛАБУБУ ТОЖЕ БЫВАЮТ СКАЗАЛ МЕДВЕДЬ ВАЛЕРА

И ТАКИЕ ЛАБУБУ ТОЖЕ БЫВАЮТ СКАЗАЛ МЕДВЕДЬ ВАЛЕРА

BBS 3rd Year Taxation in Nepal | Top 20 Most Repeated Questions Solved | TU Exam 2081

BBS 3rd Year Taxation in Nepal | Top 20 Most Repeated Questions Solved | TU Exam 2081

Роналду пропал!

Роналду пропал!

Я Добыл Самое Сильное Оружие в Майнкрафте

Я Добыл Самое Сильное Оружие в Майнкрафте

Can You Catch These Numbers Correctly? | Dates, Prices, Addresses & More!

Can You Catch These Numbers Correctly? | Dates, Prices, Addresses & More!

7 Дней в САМЫХ СЕКРЕТНЫХ МЕСТАХ КИТАЯ! Такого мы не ожидали..

7 Дней в САМЫХ СЕКРЕТНЫХ МЕСТАХ КИТАЯ! Такого мы не ожидали..

Ликвидация главы ФСБ? / Спецоперация спецслужб

Ликвидация главы ФСБ? / Спецоперация спецслужб

Японец по цене ВАЗа! Оживляем пацанскую мечту :)

Японец по цене ВАЗа! Оживляем пацанскую мечту :)

NEW Google Gemini CLI Agent is INSANE (FREE!) 🤯

NEW Google Gemini CLI Agent is INSANE (FREE!) 🤯

Effort Without God Isn't Enough

Effort Without God Isn't Enough

© 2025 ycliper. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]