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

Marc mnations at airmail.net
Fri Feb 28 18:27:27 EST 2003


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