GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Wed Apr 16, 2014 4:25 am

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 
Offline
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!
Sandra

#Make a box
self.box = gtk.HBox(homogeneous=False)
self.mainbox.pack_start(self.box)
self.box.show()

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

self.textbox = gtk.VBox()
self.box.pack_start(self.textbox)
self.textbox.show()

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

chosenpos = gtk.CheckButton(pos)
chosenpos.set_active(True)
#testbox.pack_start(chosenpos)
buttonbox.pack_start(chosenpos)
buttontuple = (word, pos, chosenpos)
self.buttonlist.append(buttontuple)
chosenpos.show()

for alt in alts:
cbutton = gtk.CheckButton(alt.strip())
#testbox.pack_start(cbutton)
buttonbox.pack_start(cbutton)
buttontuple = (word, alt.strip(), cbutton)
self.buttonlist.append(buttontuple)
cbutton.show()
altstr = altstr + " and " + alt

if len(alts) > 1:
altbutton = gtk.CheckButton(altstr)
#testbox.pack_start(altbutton)
buttonbox.pack_start(altbutton)
buttontuple = (word, altstr, altbutton)
self.buttonlist.append(buttontuple)
altbutton.show()

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

#textframe.add(testbox)
#textframe.add(buttonbox)
textlabel.show()
#textframe.show()
testbox.show()
buttonbox.show()
#self.textbox.pack_start(textframe)
self.textbox.pack_start(testbox)
self.textbox.pack_start(buttonbox)


Top
 Profile  
 
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: Google [Bot] and 3 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