GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Sun Feb 14, 2016 12:42 pm

All times are UTC

Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Problems with aligning and spacing widgets
PostPosted: Thu May 08, 2008 10:06 am 
Familiar Face

Joined: Thu May 08, 2008 9:50 am
Posts: 8
I am working on a GUI that should present a picture representing a word, the word and information about it. I have two main problems.

The first one is: I have created two vertical boxes, positioned next to each other inside a horizontal box. In the right one, I present all pictures, each in one box. In the other one, I present the information to the picture. My problem is that the pictureboxes and the corresponding textboxes don't get the same size (depending on how much text and how big the pic is). I'd like them to correspond so you right away can see which pic belongs to which text. I tried at first to make a lot of horizontal boxes with picbox + textbox in it, which solved the problem - but the different hboxes were not the same size. How do I do to make boxes the same size, both inside the same box and in another box? Must I make a table? I don't know the size of the table (how many pics there are, can I do a table anyway?)

My other problem: In the textboxes, I write a little piece of text, and then I have some checkbuttons. The number of checkbuttons is different from box to box (between one and five). The spacing between the buttons is different and I'd like them to be at the same distance from each other in all boxes. I guess this has to do with them being different in number and also depending on the text's size. Can I adjust this in some way?

Here comes the code. Maybe it is a bit long, but I hope there is everything you need to understand it. Before, I had a frame for each box, I removed it because I thought it had something to do with the problem, but it didn't. Before, the text and the buttons were packed into the same box (testbox) and this was added to the frame, which was added to the main box.

Thankful for all help!

#Make a box = gtk.HBox(homogeneous=False)

#2 boxes inside box
self.picbox = gtk.VBox()

self.textbox = gtk.VBox()

#Creates the texts and buttons
testbox = gtk.VBox()
buttonbox = gtk.VBox()
#textframe = gtk.Frame(filename)
textlabel = gtk.Label(textstr)
altstr = ""

chosenpos = gtk.CheckButton(pos)
buttontuple = (word, pos, chosenpos)

for alt in alts:
cbutton = gtk.CheckButton(alt.strip())
buttontuple = (word, alt.strip(), cbutton)
altstr = altstr + " and " + alt

if len(alts) > 1:
altbutton = gtk.CheckButton(altstr)
buttontuple = (word, altstr, altbutton)

#If the chosen pos gives wrong meaning and no alts are correct:
crobutton = gtk.CheckButton("Fel - ska till CRO")
buttontuple = (word, "CRO", crobutton)


Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group