Deutsch   English   Français   Italiano  
<mailman.79.1730831336.4695.python-list@python.org>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!fu-berlin.de!uni-berlin.de!not-for-mail
From: Vishal Chandratreya <vpaijc@gmail.com>
Newsgroups: comp.lang.python
Subject: Re: TkInter Scrolled Listbox class?
Date: Tue, 5 Nov 2024 23:58:38 +0530
Lines: 58
Message-ID: <mailman.79.1730831336.4695.python-list@python.org>
References: <20241104163248.108d895a431837a246a22fe4@fam-goebel.de>
 <6B6251E9-0E4E-4021-A244-2D4E26E7C1AB@gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="utf-8"
X-Trace: news.uni-berlin.de fQo2qrMKfbgHRZBwS57BegVgy72fD33us9NJyCc7n0rw==
Cancel-Lock: sha1:yPIMmT+End+U0tuE+1boSH+gq40= sha256:4mQyz47L4Xwh+5mMN8VVRycRE6Eb2TJBtX6wWqV6bP8=
Return-Path: <vpaijc@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
 reason="2048-bit key; unprotected key"
 header.d=gmail.com header.i=@gmail.com header.b=gWf1CmIb;
 dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.002
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'def': 0.04; 'containing':
 0.05; 'usage': 0.05; 'tkinter': 0.07; 'url:mailman': 0.09;
 'cc:addr:python-list': 0.09; 'instances': 0.09; 'populate': 0.09;
 'subject:class': 0.09; 'widgets': 0.09; 'cc:no real name:2**0':
 0.14; 'url:listinfo': 0.15; 'for.': 0.16; 'possible?': 0.16;
 'received:apple': 0.16; 'received:smtpclient.apple': 0.16;
 'scenario,': 0.16; 'url:project': 0.16; 'url:pypi': 0.16;
 'wrote:': 0.16; 'problem': 0.16; "can't": 0.17; 'message-
 id:@gmail.com': 0.18; 'cc:addr:python.org': 0.20; 'url-
 ip:188.166.95.178/32': 0.20; 'url-ip:188.166.95/24': 0.20; 'skip:_
 10': 0.22; 'url-ip:188.166/16': 0.24; 'cc:2**0': 0.25; 'seems':
 0.26; 'configure': 0.26; 'practices': 0.26; 'bit': 0.27; 'email
 addr:python.org>': 0.28; 'dir="ltr"': 0.31; 'python-list':
 0.32; 'skip:w 40': 0.32; 'but': 0.32; 'header:In-Reply-To:1':
 0.34; 'received:google.com': 0.34; 'from:addr:gmail.com': 0.34;
 'really': 0.36; '...': 0.37; 'could': 0.37; 'class': 0.37; 'url-
 ip:151.101.0.223/32': 0.38; 'url-ip:151.101.128.223/32': 0.38;
 'url-ip:151.101.192.223/32': 0.38; 'url-ip:151.101.64.223/32':
 0.38; 'put': 0.38; 'list': 0.39; 'use': 0.39; 'two': 0.39;
 'handle': 0.39; 'best': 0.61; 'arial,': 0.62; 'i\xe2\x80\x99ve':
 0.62; 'your': 0.64; 'pack': 0.64; 'received:49': 0.64; 'box':
 0.65; 'helvetica,': 0.69; 'packed': 0.69; 'skip:f 30': 0.71;
 'skip:f 20': 0.75; 'href=""': 0.84; 'attribute': 0.84; 'email
 name:<python-list': 0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1730831333; x=1731436133; darn=python.org;
 h=to:in-reply-to:cc:references:message-id:date:subject:mime-version
 :from:content-transfer-encoding:from:to:cc:subject:date:message-id
 :reply-to; bh=+OsccyW6ByVHxrM9QX/WIDwk47X6NbktA8BBgjfgrpM=;
 b=gWf1CmIbwsC1QcC+lVv8GH81NkPGm2Fs1V0RG3iGoE7M5aAskkcMvPTlDl0h95QRQO
 JYW5CiuUPncAuENQWz3T4D3aceBeQlbIZgpw0SlCc7hhSG54qOOymxkn6sgBbpjNnbxB
 jmzf3uAlnsEtcb14DLPJAWCx2oeyyo1lvkExUmkJ+0Limwu3k/2H6ZZJNGhC8N7GmY00
 edPufAKssqXZ6ZKxaRNm/YDPlwQscwKyVrL2Zd0kqS/auxmAqD3EbrdRvswxFiv1td/A
 WXSFIxXf/kpK8FTJFOgwcBREPCOCQM96sNSdlBL1iywQCZfDo/yf3OMBliptVVHbkJ+R
 LKrw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1730831333; x=1731436133;
 h=to:in-reply-to:cc:references:message-id:date:subject:mime-version
 :from:content-transfer-encoding:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=+OsccyW6ByVHxrM9QX/WIDwk47X6NbktA8BBgjfgrpM=;
 b=lUaCyNsiNoijY/oColJobuw81lZ7A2eh2SyjXt/QI7vfhLg0j9ff2Ujuuy5ct9BAwf
 Ou/T6IErXc8pztUv21WypEhVaOlDK/sv4YV+H7DgsSStK+0XZieyrNY9gKY70aiY+nFU
 y+UiCNJbGa6NIe8fYqhWLcIi/dAnOiZG1/9NP4RPq/qm/aN6mmkUVrKm820A+Al2I1o9
 hWVKf7XXNBr5f6vtCo93X97OehmNga6jXXu76AthrKU4KrUSC8t135g7Sl7l9p+6zFZ8
 sjyWlUimRclFCPNT9Tr3U2tNV4JzNhh6ggqDQlTvlvJlBZg32I3lIv0+p4+AU+m8s2Qi
 v5WQ==
X-Gm-Message-State: AOJu0Yx3aMdL1HAAVvPXKxZtnTTP/L2OAroU0DhfhMkaVI7tkJRmIsUn
 tAoneJ05Bo+GGV9jP3IfQldgOn/NN3ZJTWNqXbMHq+GSIgICItN/iEDtnQ==
X-Google-Smtp-Source: AGHT+IGgz/7vjRNIlG3PgI/iHhmJ7xcjuArheYAbo6aVEGrQtxyjhV8NwZEWcIp8Ubj8WSYl9OLpRA==
X-Received: by 2002:a17:90b:1bd2:b0:2e0:9d3e:bc2a with SMTP id
 98e67ed59e1d1-2e94c51c5f2mr23569474a91.32.1730831333014; 
 Tue, 05 Nov 2024 10:28:53 -0800 (PST)
In-Reply-To: <20241104163248.108d895a431837a246a22fe4@fam-goebel.de>
X-Mailer: iPhone Mail (21G93)
X-Content-Filtered-By: Mailman/MimeDel 2.1.39
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
 <python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
 <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
 <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <6B6251E9-0E4E-4021-A244-2D4E26E7C1AB@gmail.com>
X-Mailman-Original-References: <20241104163248.108d895a431837a246a22fe4@fam-goebel.de>
Bytes: 7681

   This is what I created ScrollableContainers for. Its usage deviates a bit
   from standard Tkinter practices in that you add widgets to the frame
   attribute of a ScrollableFrameTk instance. 

       [1]twitter.abaf4b19.webp
   [2]ScrollableContainers
   pypi.org

   For your use case, you could populate your list box and then put it inside
   that frame. I’ve not tested this scenario, so I’d appreciate feedback!
   Thanks. 

     On 4 Nov 2024, at 21:28, Ulrich Goebel via Python-list
     <python-list@python.org> wrote:

     Hi,
     I would like to build a class ScrolledListbox, which can be packed
     somewhere in ttk.Frames. What I did is to build not really a scrolled
     Listbox but a Frame containing a Listbox and a Scrollbar:
     class FrameScrolledListbox(ttk.Frame):
        def __init__(self, *args, **kwargs):
            super().__init__(*args, **kwargs)
            #
            # build Listbox and Scrollbar
            self.Listbox = tk.Listbox(self)
            self.Scrollbar = ttk.Scrollbar(self)
            #
            # configure these two
            self.Listbox.config(yscrollcommand=self.Scrollbar.set)
            self.Scrollbar.config(command=self.Listbox.yview)
            #
            # pack them in Frame
            self.Listbox.pack(side=tk.LEFT, fill=tk.BOTH)
            self.Scrollbar.pack(side=tk.RIGHT, fill=tk.BOTH)
     That works, so instances of FrameScrolledListbox can be packed and the
     tk.Listbox itself is accessible via an attribute:
     frmScrolledListbox = FrameScrolledListbox(main)
     frmScrolledListbox.Listbox.config(...)
     But it would be a bit nicer to get a class like
     class ScrolledListbox(tk.Listbox):
        ...
     So it would be used that way:
     scrolledListbox = ScrolledListbox(main)
     scrolledListbox.config(...)
     Is that possible? The problem which I can't handle is to handle the
     Frame which seems to be needed to place the Scrollbar somewhere.
     Best regards
     Ulrich
     --
     Ulrich Goebel <ml@fam-goebel.de>
     --
     https://mail.python.org/mailman/listinfo/python-list

References

   Visible links
   1. https://pypi.org/project/ScrollableContainers/
   2. https://pypi.org/project/ScrollableContainers/