Skip Menu |

This queue is for tickets about the Tk CPAN distribution.

Report information
The Basics
Id: 61797
Status: open
Priority: 0/
Queue: Tk

People
Owner: Nobody in particular
Requestors: Gus.Ikonomopoulos [...] freescale.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Perl Tk Pane Issue ...
Date: Thu, 30 Sep 2010 13:05:29 -0500
To: <bug-Tk [...] rt.cpan.org>
From: Gus Ikonomopoulos <Gus.Ikonomopoulos [...] freescale.com>
I am having trouble getting widgets placed within a scrolled pane to be sticky to its edges. I have attached an example, which illustrates the issue. It also contains a regular pane (not scrolled) and a frame, which both work well. Please, make sure you re-size the GUI also. Here is a copy of the text placed within my PERL script ... Created to show a discrepancy between a "Scrolled Pane" and a "Pane". Widgets added to each behave differently. I am unable to make them sticky to the edges of a "Scrolled Pane" ($widget_pn_0), even after re-sizing. I am able to do this with a "Pane" ($widget_pn_1), though. I've also included a "Frame" ($widget_fm_0), which works as well. Command: perl -v This is perl 5, version 12, subversion 1 (v5.12.1) built for x86_64-linux-thread-multi From: Tk.pm $Tk::version = '8.4'; $Tk::patchLevel = '8.4'; $Tk::VERSION = '804.029'; Command: uname -a Linux ra5715-ec1 2.6.9-55.0.12.EL #1 Wed Oct 17 08:06:24 EDT 2007 x86_64 unknown Any help would be appreciated. Thanks, Gus
#!perl -w # 1.00 09/30/10 Gus Ikonomopoulos # - Initial revision # Created to show a discrepancy between a "Scrolled Pane" and a "Pane". # Widgets added to each behave differently. I am unable to make them # sticky to the edges of a "Scrolled Pane" ($widget_pn_0), even after # re-sizing. I am able to do this with a "Pane" ($widget_pn_1), # though. I've also included a "Frame" ($widget_fm_0), which works as # well. # # Command: perl -v # This is perl 5, version 12, subversion 1 (v5.12.1) built for # x86_64-linux-thread-multi # # From: Tk.pm # $Tk::version = '8.4'; # $Tk::patchLevel = '8.4'; # $Tk::VERSION = '804.029'; # # Command: uname -a # Linux ra5715-ec1 2.6.9-55.0.12.EL #1 Wed Oct 17 08:06:24 EDT 2007 # x86_64 unknown # ------------------------------------------------------------------------------ # Libraries: # ------------------------------------------------------------------------------ use strict; use Tk; use Tk::NoteBook; use Tk::Pane; # ------------------------------------------------------------------------------ # GUI: Main Window # ------------------------------------------------------------------------------ my $widget_mw = MainWindow->new(); # Title $widget_mw->title("Perl Tk Pane Issue"); # Pane 0 my $widget_pn_0 = $widget_mw-> Scrolled ( "Pane", -borderwidth => 5, -gridded => "xy", -scrollbars => "osoe", -sticky => "nsew" # Not sure why I need 'sticky'. It's already # specified below in its 'grid' placement. This # does nothing. ); # Pane 1 my $widget_pn_1 = $widget_mw-> Pane ( -borderwidth => 5, -gridded => "xy", -sticky => "nsew" # Not sure why I need 'sticky'. It's already # specified below in its 'grid' placement. This # seems to be required for it to work. ); # Frame 0 my $widget_fm_0 = $widget_mw-> Frame ( -borderwidth => 5 ); # -- Grid Configuration -- $widget_mw->gridColumnconfigure( 0, -weight => 1); $widget_mw->gridRowconfigure ( 0, -weight => 1); $widget_mw->gridRowconfigure ( 1, -weight => 1); $widget_mw->gridRowconfigure ( 2, -weight => 1); # -- Grid Placement -- $widget_pn_0-> grid ( -column => 0, -row => 0, -sticky => "nsew" ); $widget_pn_1-> grid ( -column => 0, -row => 1, -sticky => "nsew" ); $widget_fm_0-> grid ( -column => 0, -row => 2, -sticky => "nsew" ); # ------------------------------------------------------------------------------ # GUI: Pane 0 # ------------------------------------------------------------------------------ # Label 0 my $widget_lbl_0 = $widget_pn_0-> Label ( -text => "Scrolled Pane (widget_pn_0)" ); # Frame 1 my $widget_fm_1 = $widget_pn_0-> Frame ( -borderwidth => 5, -height => 20 ); # Frame 2 my $widget_fm_2 = $widget_pn_0-> Frame ( -borderwidth => 5, -height => 20 ); # Frame 3 my $widget_fm_3 = $widget_pn_0-> Frame ( -borderwidth => 5, -height => 20 ); # Frame 4 my $widget_fm_4 = $widget_pn_0-> Frame ( -borderwidth => 5, -height => 20 ); # Frame 5 my $widget_fm_5 = $widget_pn_0-> Frame ( -borderwidth => 5, -height => 20 ); # -- Grid Configuration -- $widget_pn_0->gridColumnconfigure( 0, -weight => 1); $widget_pn_0->gridRowconfigure ( 0, -weight => 1); $widget_pn_0->gridRowconfigure ( 1, -weight => 1); $widget_pn_0->gridRowconfigure ( 2, -weight => 1); $widget_pn_0->gridRowconfigure ( 3, -weight => 1); $widget_pn_0->gridRowconfigure ( 4, -weight => 1); $widget_pn_0->gridRowconfigure ( 5, -weight => 1); # -- Grid Placement -- $widget_lbl_0-> grid ( -column => 0, -row => 0, -sticky => "nsew" ); $widget_fm_1-> grid ( -column => 0, -row => 1, -sticky => "nsew" ); $widget_fm_2-> grid ( -column => 0, -row => 2, -sticky => "nsew" ); $widget_fm_3-> grid ( -column => 0, -row => 3, -sticky => "nsew" ); $widget_fm_4-> grid ( -column => 0, -row => 4, -sticky => "nsew" ); $widget_fm_5-> grid ( -column => 0, -row => 5, -sticky => "nsew" ); # ------------------------------------------------------------------------------ # GUI: Pane 1 # ------------------------------------------------------------------------------ # Label 1 my $widget_lbl_1 = $widget_pn_1-> Label ( -text => "Pane (widget_pn_1)" ); # Frame 6 my $widget_fm_6 = $widget_pn_1-> Frame ( -borderwidth => 5, -height => 20 ); # Frame 7 my $widget_fm_7 = $widget_pn_1-> Frame ( -borderwidth => 5, -height => 20 ); # Frame 8 my $widget_fm_8 = $widget_pn_1-> Frame ( -borderwidth => 5, -height => 20 ); # Frame 9 my $widget_fm_9 = $widget_pn_1-> Frame ( -borderwidth => 5, -height => 20 ); # Frame 10 my $widget_fm_10 = $widget_pn_1-> Frame ( -borderwidth => 5, -height => 20 ); # -- Grid Configuration -- $widget_pn_1->gridColumnconfigure( 0, -weight => 1); $widget_pn_1->gridRowconfigure ( 0, -weight => 1); $widget_pn_1->gridRowconfigure ( 1, -weight => 1); $widget_pn_1->gridRowconfigure ( 2, -weight => 1); $widget_pn_1->gridRowconfigure ( 3, -weight => 1); $widget_pn_1->gridRowconfigure ( 4, -weight => 1); $widget_pn_1->gridRowconfigure ( 5, -weight => 1); # -- Grid Placement -- $widget_lbl_1-> grid ( -column => 0, -row => 0, -sticky => "nsew" ); $widget_fm_6-> grid ( -column => 0, -row => 1, -sticky => "nsew" ); $widget_fm_7-> grid ( -column => 0, -row => 2, -sticky => "nsew" ); $widget_fm_8-> grid ( -column => 0, -row => 3, -sticky => "nsew" ); $widget_fm_9-> grid ( -column => 0, -row => 4, -sticky => "nsew" ); $widget_fm_10-> grid ( -column => 0, -row => 5, -sticky => "nsew" ); # ------------------------------------------------------------------------------ # GUI: Frame 0 # ------------------------------------------------------------------------------ # Label 2 my $widget_lbl_2 = $widget_fm_0-> Label ( -text => "Frame (widget_fm_0)" ); # Frame 11 my $widget_fm_11 = $widget_fm_0-> Frame ( -borderwidth => 5, -height => 20 ); # Frame 12 my $widget_fm_12 = $widget_fm_0-> Frame ( -borderwidth => 5, -height => 20 ); # Frame 13 my $widget_fm_13 = $widget_fm_0-> Frame ( -borderwidth => 5, -height => 20 ); # Frame 14 my $widget_fm_14 = $widget_fm_0-> Frame ( -borderwidth => 5, -height => 20 ); # Frame 15 my $widget_fm_15 = $widget_fm_0-> Frame ( -borderwidth => 5, -height => 20 ); # -- Grid Configuration -- $widget_fm_0->gridColumnconfigure( 0, -weight => 1); $widget_fm_0->gridRowconfigure ( 0, -weight => 1); $widget_fm_0->gridRowconfigure ( 1, -weight => 1); $widget_fm_0->gridRowconfigure ( 2, -weight => 1); $widget_fm_0->gridRowconfigure ( 3, -weight => 1); $widget_fm_0->gridRowconfigure ( 4, -weight => 1); $widget_fm_0->gridRowconfigure ( 5, -weight => 1); # -- Grid Placement -- $widget_lbl_2-> grid ( -column => 0, -row => 0, -sticky => "nsew" ); $widget_fm_11-> grid ( -column => 0, -row => 1, -sticky => "nsew" ); $widget_fm_12-> grid ( -column => 0, -row => 2, -sticky => "nsew" ); $widget_fm_13-> grid ( -column => 0, -row => 3, -sticky => "nsew" ); $widget_fm_14-> grid ( -column => 0, -row => 4, -sticky => "nsew" ); $widget_fm_15-> grid ( -column => 0, -row => 5, -sticky => "nsew" ); # ------------------------------------------------------------------------------ # Widget Colors: # ------------------------------------------------------------------------------ $widget_pn_0-> configure ( -background => "SlateGray1" ); $widget_pn_1-> configure ( -background => "SlateGray2" ); $widget_fm_0-> configure ( -background => "SlateGray3" ); $widget_fm_1-> configure ( -background => "DarkGray" ); $widget_fm_3-> configure ( -background => "DarkGray" ); $widget_fm_5-> configure ( -background => "DarkGray" ); $widget_fm_6-> configure ( -background => "DarkGray" ); $widget_fm_8-> configure ( -background => "DarkGray" ); $widget_fm_10-> configure ( -background => "DarkGray" ); $widget_fm_11-> configure ( -background => "DarkGray" ); $widget_fm_13-> configure ( -background => "DarkGray" ); $widget_fm_15-> configure ( -background => "DarkGray" ); # ------------------------------------------------------------------------------ # Main Loop: # ------------------------------------------------------------------------------ $widget_mw->MainLoop();
As a workaround, pack() a Frame into your "Scrolled Pane" and grid() your widgets into that Frame (see attached).
Subject: perl_tk_pane_issue2.pl
#!perl -w # 1.00 09/30/10 Gus Ikonomopoulos # - Initial revision # Created to show a discrepancy between a "Scrolled Pane" and a "Pane". # Widgets added to each behave differently. I am unable to make them # sticky to the edges of a "Scrolled Pane" ($widget_pn_0), even after # re-sizing. I am able to do this with a "Pane" ($widget_pn_1), # though. I've also included a "Frame" ($widget_fm_0), which works as # well. # # Command: perl -v # This is perl 5, version 12, subversion 1 (v5.12.1) built for # x86_64-linux-thread-multi # # From: Tk.pm # $Tk::version = '8.4'; # $Tk::patchLevel = '8.4'; # $Tk::VERSION = '804.029'; # # Command: uname -a # Linux ra5715-ec1 2.6.9-55.0.12.EL #1 Wed Oct 17 08:06:24 EDT 2007 # x86_64 unknown # ------------------------------------------------------------------------------ # Libraries: # ------------------------------------------------------------------------------ use strict; use Tk; use Tk::NoteBook; use Tk::Pane; # ------------------------------------------------------------------------------ # GUI: Main Window # ------------------------------------------------------------------------------ my $widget_mw = MainWindow->new(); # Title $widget_mw->title("Perl Tk Pane Issue"); # Pane 0 my $widget_pn_0g = $widget_mw-> Scrolled ( "Pane", -borderwidth => 5, -gridded => "xy", -scrollbars => "osoe", -sticky => "nsew" # Not sure why I need 'sticky'. It's already # specified below in its 'grid' placement. This # does nothing. ); my $widget_pn_0 = $widget_pn_0g->Frame(-background => 'green')->pack(-fill => 'both', -expand => 1); # Pane 1 my $widget_pn_1 = $widget_mw-> Pane ( -borderwidth => 5, -gridded => "xy", -sticky => "nsew" # Not sure why I need 'sticky'. It's already # specified below in its 'grid' placement. This # seems to be required for it to work. ); # Frame 0 my $widget_fm_0 = $widget_mw-> Frame ( -borderwidth => 5 ); # -- Grid Configuration -- $widget_mw->gridColumnconfigure( 0, -weight => 1); $widget_mw->gridRowconfigure ( 0, -weight => 1); $widget_mw->gridRowconfigure ( 1, -weight => 1); $widget_mw->gridRowconfigure ( 2, -weight => 1); # -- Grid Placement -- $widget_pn_0g-> grid ( -column => 0, -row => 0, -sticky => "nsew" ); $widget_pn_1-> grid ( -column => 0, -row => 1, -sticky => "nsew" ); $widget_fm_0-> grid ( -column => 0, -row => 2, -sticky => "nsew" ); # ------------------------------------------------------------------------------ # GUI: Pane 0 # ------------------------------------------------------------------------------ # Label 0 my $widget_lbl_0 = $widget_pn_0-> Label ( -text => "Scrolled Pane (widget_pn_0)" ); # Frame 1 my $widget_fm_1 = $widget_pn_0-> Frame ( -borderwidth => 5, -height => 20 ); # Frame 2 my $widget_fm_2 = $widget_pn_0-> Frame ( -borderwidth => 5, -height => 20 ); # Frame 3 my $widget_fm_3 = $widget_pn_0-> Frame ( -borderwidth => 5, -height => 20 ); # Frame 4 my $widget_fm_4 = $widget_pn_0-> Frame ( -borderwidth => 5, -height => 20 ); # Frame 5 my $widget_fm_5 = $widget_pn_0-> Frame ( -borderwidth => 5, -height => 20 ); # -- Grid Configuration -- $widget_pn_0->gridColumnconfigure( 0, -weight => 1); $widget_pn_0->gridRowconfigure ( 0, -weight => 1); $widget_pn_0->gridRowconfigure ( 1, -weight => 1); $widget_pn_0->gridRowconfigure ( 2, -weight => 1); $widget_pn_0->gridRowconfigure ( 3, -weight => 1); $widget_pn_0->gridRowconfigure ( 4, -weight => 1); $widget_pn_0->gridRowconfigure ( 5, -weight => 1); # -- Grid Placement -- $widget_lbl_0-> grid ( -column => 0, -row => 0, -sticky => "nsew" ); $widget_fm_1-> grid ( -column => 0, -row => 1, -sticky => "nsew" ); $widget_fm_2-> grid ( -column => 0, -row => 2, -sticky => "nsew" ); $widget_fm_3-> grid ( -column => 0, -row => 3, -sticky => "nsew" ); $widget_fm_4-> grid ( -column => 0, -row => 4, -sticky => "nsew" ); $widget_fm_5-> grid ( -column => 0, -row => 5, -sticky => "nsew" ); # ------------------------------------------------------------------------------ # GUI: Pane 1 # ------------------------------------------------------------------------------ # Label 1 my $widget_lbl_1 = $widget_pn_1-> Label ( -text => "Pane (widget_pn_1)" ); # Frame 6 my $widget_fm_6 = $widget_pn_1-> Frame ( -borderwidth => 5, -height => 20 ); # Frame 7 my $widget_fm_7 = $widget_pn_1-> Frame ( -borderwidth => 5, -height => 20 ); # Frame 8 my $widget_fm_8 = $widget_pn_1-> Frame ( -borderwidth => 5, -height => 20 ); # Frame 9 my $widget_fm_9 = $widget_pn_1-> Frame ( -borderwidth => 5, -height => 20 ); # Frame 10 my $widget_fm_10 = $widget_pn_1-> Frame ( -borderwidth => 5, -height => 20 ); # -- Grid Configuration -- $widget_pn_1->gridColumnconfigure( 0, -weight => 1); $widget_pn_1->gridRowconfigure ( 0, -weight => 1); $widget_pn_1->gridRowconfigure ( 1, -weight => 1); $widget_pn_1->gridRowconfigure ( 2, -weight => 1); $widget_pn_1->gridRowconfigure ( 3, -weight => 1); $widget_pn_1->gridRowconfigure ( 4, -weight => 1); $widget_pn_1->gridRowconfigure ( 5, -weight => 1); # -- Grid Placement -- $widget_lbl_1-> grid ( -column => 0, -row => 0, -sticky => "nsew" ); $widget_fm_6-> grid ( -column => 0, -row => 1, -sticky => "nsew" ); $widget_fm_7-> grid ( -column => 0, -row => 2, -sticky => "nsew" ); $widget_fm_8-> grid ( -column => 0, -row => 3, -sticky => "nsew" ); $widget_fm_9-> grid ( -column => 0, -row => 4, -sticky => "nsew" ); $widget_fm_10-> grid ( -column => 0, -row => 5, -sticky => "nsew" ); # ------------------------------------------------------------------------------ # GUI: Frame 0 # ------------------------------------------------------------------------------ # Label 2 my $widget_lbl_2 = $widget_fm_0-> Label ( -text => "Frame (widget_fm_0)" ); # Frame 11 my $widget_fm_11 = $widget_fm_0-> Frame ( -borderwidth => 5, -height => 20 ); # Frame 12 my $widget_fm_12 = $widget_fm_0-> Frame ( -borderwidth => 5, -height => 20 ); # Frame 13 my $widget_fm_13 = $widget_fm_0-> Frame ( -borderwidth => 5, -height => 20 ); # Frame 14 my $widget_fm_14 = $widget_fm_0-> Frame ( -borderwidth => 5, -height => 20 ); # Frame 15 my $widget_fm_15 = $widget_fm_0-> Frame ( -borderwidth => 5, -height => 20 ); # -- Grid Configuration -- $widget_fm_0->gridColumnconfigure( 0, -weight => 1); $widget_fm_0->gridRowconfigure ( 0, -weight => 1); $widget_fm_0->gridRowconfigure ( 1, -weight => 1); $widget_fm_0->gridRowconfigure ( 2, -weight => 1); $widget_fm_0->gridRowconfigure ( 3, -weight => 1); $widget_fm_0->gridRowconfigure ( 4, -weight => 1); $widget_fm_0->gridRowconfigure ( 5, -weight => 1); # -- Grid Placement -- $widget_lbl_2-> grid ( -column => 0, -row => 0, -sticky => "nsew" ); $widget_fm_11-> grid ( -column => 0, -row => 1, -sticky => "nsew" ); $widget_fm_12-> grid ( -column => 0, -row => 2, -sticky => "nsew" ); $widget_fm_13-> grid ( -column => 0, -row => 3, -sticky => "nsew" ); $widget_fm_14-> grid ( -column => 0, -row => 4, -sticky => "nsew" ); $widget_fm_15-> grid ( -column => 0, -row => 5, -sticky => "nsew" ); # ------------------------------------------------------------------------------ # Widget Colors: # ------------------------------------------------------------------------------ $widget_pn_0-> configure ( -background => "SlateGray1" ); $widget_pn_1-> configure ( -background => "SlateGray2" ); $widget_fm_0-> configure ( -background => "SlateGray3" ); $widget_fm_1-> configure ( -background => "DarkGray" ); $widget_fm_3-> configure ( -background => "DarkGray" ); $widget_fm_5-> configure ( -background => "DarkGray" ); $widget_fm_6-> configure ( -background => "DarkGray" ); $widget_fm_8-> configure ( -background => "DarkGray" ); $widget_fm_10-> configure ( -background => "DarkGray" ); $widget_fm_11-> configure ( -background => "DarkGray" ); $widget_fm_13-> configure ( -background => "DarkGray" ); $widget_fm_15-> configure ( -background => "DarkGray" ); # ------------------------------------------------------------------------------ # Main Loop: # ------------------------------------------------------------------------------ $widget_mw->MainLoop();