GUI Design problem: How can I remove space between widgets on a canvas?

Marc losnations at comcast.net
Fri Feb 28 21:07:09 EST 2003


Update:

If I use Labels as opposed to Buttons, then they line up perfectly. So
obviously it's a spacing issue with the button, possibly with the raised and
lowered settings before and after it's pressed. I've tried using the
different reliefs, but somehow there always seems to a buffer between them.
I've also tried using the Checkbutton and Radiobutton with (indicatoron=0),
but it's even worse.

I need to have a widget with a command option because I need to peform a
callback when it's pressed. Any ideas?





"Marc" <mnations at airmail.net> wrote in message
news:4378fa6f.0302281527.a72c761 at posting.google.com...
> Hi all,
>
> Needless to say I have tried various ways and read several sources and
> can't quite get this work. What I am trying to do is take the front
> panel off of a piece of equipment and turn that into a GUI controlled
> interface. I have a bitmap picture of the front panel that I have
> split up in several areas, each corresponding to a different area of
> control. These I plan to turn into buttons that can be toggled from
> the gui.
>
> The problem is that I want to place all of these picture/buttons on
> the canvas with a seamless appearance which will look exactly like the
> front panel when reconstructed in the GUI. I use the canvas and place
> them precisely on the screen, however, no matter how I finagle the
> options on all the widgets, there is always a small sliver of space
> left between them. The closest I have come to perfection is the
> following snippet of code:
>
>         canvas = Canvas(cardFrame, height=170, width=250,
> highlightthickness=0,
>                         relief=GROOVE, borderwidth=4)
>         canvas.pack_propagate(0)
>
>         eqptFrame1 = Frame( canvas, borderwidth=0 )
>         Button(eqptFrame1, image=self.image1a,
> borderwidth=0).pack(side=LEFT)
>         canvas.create_window(75,150, window=eqptFrame1, anchor=CENTER)
>
>         eqptFrame2 = Frame( canvas, borderwidth=0 )
>         Button(eqptFrame2, image=self.image1b,
> borderwidth=0).pack(side=LEFT)
>         canvas.create_window(165,150, window=eqptFrame2,
> anchor=CENTER)
>
>         canvas.pack()
>
> I have set all the borderwidths to '0', and I still have a space that
> couldn't be but a pixel wide. I don't know anything else to try. Has
> anyone tried this or know how to fix this problem? I am also open to
> trying different methods than the canvas to achieve this if possible.
>
> Thanks ahead of time,
> Marc






More information about the Python-list mailing list