several questions about Glade & pygtk

Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Sep 2009
Posts: 84
Reputation: Kruptein is an unknown quantity at this point 
Solved Threads: 5
Kruptein's Avatar
Kruptein Kruptein is offline Offline
Junior Poster in Training

several questions about Glade & pygtk

 
0
  #1
29 Days Ago
1. Is it possible to draw a border line around a table and/or a cell
2. Is it possible to draw a color to the background of a label.
2bis If not, is there an other element that can have background colors
3 How can I set the default height and width from a window(toplevel).
I tried to use default height and default width
(sounds quit logic) but the window always stays in the same
small format

I hope someone knows the answer at one of these questions.
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 4,047
Reputation: vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice 
Solved Threads: 935
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
DaniWeb's Hypocrite
 
0
  #2
29 Days Ago
I hope you have luck finding someone who actually uses pygtk. I run on a Windows platform and pygtk is a bear to install.
May 'the Google' be with you!
Reply With Quote Quick reply to this message  
Join Date: Nov 2009
Posts: 41
Reputation: ShadyTyrant is an unknown quantity at this point 
Solved Threads: 8
ShadyTyrant's Avatar
ShadyTyrant ShadyTyrant is offline Offline
Light Poster
 
0
  #3
29 Days Ago
I was using pygtk, glade, and gladegen for a short time and I really wasn't impressed. I cant help with your problem but I may suggest an alternative of wxGlade. With wxGlade it will turn the gui you create right in to source code. http://wxglade.sourceforge.net/
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 84
Reputation: Kruptein is an unknown quantity at this point 
Solved Threads: 5
Kruptein's Avatar
Kruptein Kruptein is offline Offline
Junior Poster in Training
 
0
  #4
29 Days Ago
Okay, it's good someone tells me at this point pygtk isn't that usefull,
so wxpython is better supported on both windows and linux?

I will give it a try
Reply With Quote Quick reply to this message  
Join Date: Nov 2009
Posts: 41
Reputation: ShadyTyrant is an unknown quantity at this point 
Solved Threads: 8
ShadyTyrant's Avatar
ShadyTyrant ShadyTyrant is offline Offline
Light Poster
 
0
  #5
29 Days Ago
I not so sure I would say pygtk isn't useful. I just prefer wxPython. Also both tool kits seem to be well supported on my Debian Linux box. Not so sure about Windows.
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 84
Reputation: Kruptein is an unknown quantity at this point 
Solved Threads: 5
Kruptein's Avatar
Kruptein Kruptein is offline Offline
Junior Poster in Training
 
0
  #6
28 Days Ago
Okay I started using wxGlade which is better as Glade,
but now I have one problem, I can't find a way to hide my Frame and show an other frame.
  1. class Main(wx.Frame):
  2. def __init__(self, *args, **kwds):
  3. # begin wxGlade: Main.__init__
  4. kwds["style"] = wx.DEFAULT_FRAME_STYLE
  5. wx.Frame.__init__(self, *args, **kwds)
  6. self.p1name = wx.StaticText(self, -1, "Player 1 Name:", style=wx.ALIGN_CENTRE)
  7. self.p1entry = wx.TextCtrl(self, -1, "")
  8. self.p2name = wx.StaticText(self, -1, "Player 2 Name:", style=wx.ALIGN_CENTRE)
  9. self.p2entry = wx.TextCtrl(self, -1, "")
  10. self.moneystart = wx.StaticText(self, -1, "Money:", style=wx.ALIGN_CENTRE)
  11. self.moneyentry = wx.TextCtrl(self, -1, "")
  12. self.newgamebutton = wx.Button(self, -1, "start new game")
  13. self.newgameinfo = wx.StaticText(self, -1, "Money: the ammount of\n money each player gets\n at the start")
  14.  
  15. # Menu Bar
  16. self.menubar = wx.MenuBar()
  17. wxglade_tmp_menu = wx.Menu()
  18. wxglade_tmp_menu.Append(wx.NewId(), "New", "", wx.ITEM_NORMAL)
  19. wxglade_tmp_menu.Append(wx.NewId(), "open", "", wx.ITEM_NORMAL)
  20. self.menubar.Append(wxglade_tmp_menu, "File")
  21. wxglade_tmp_menu = wx.Menu()
  22. self.menubar.Append(wxglade_tmp_menu, "Help")
  23. self.SetMenuBar(self.menubar)
  24. # Menu Bar end
  25.  
  26. self.__set_properties()
  27. self.__do_layout()
  28.  
  29. self.Bind(wx.EVT_BUTTON, self.new_game, self.newgamebutton)
  30. self.Bind(wx.EVT_MENU, self.new_game, id=-1)
  31. # end wxGlade
  32.  
  33. def __set_properties(self):
  34. # begin wxGlade: Main.__set_properties
  35. self.SetTitle("frame_1")
  36. # end wxGlade
  37.  
  38. def __do_layout(self):
  39. # begin wxGlade: Main.__do_layout
  40. sizer_1 = wx.BoxSizer(wx.VERTICAL)
  41. grid_sizer_1 = wx.GridSizer(4, 2, 0, 0)
  42. grid_sizer_1.Add(self.p1name, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
  43. grid_sizer_1.Add(self.p1entry, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
  44. grid_sizer_1.Add(self.p2name, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
  45. grid_sizer_1.Add(self.p2entry, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
  46. grid_sizer_1.Add(self.moneystart, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
  47. grid_sizer_1.Add(self.moneyentry, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
  48. grid_sizer_1.Add(self.newgamebutton, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
  49. grid_sizer_1.Add(self.newgameinfo, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
  50. sizer_1.Add(grid_sizer_1, 1, wx.EXPAND, 0)
  51. self.SetSizer(sizer_1)
  52. sizer_1.Fit(self)
  53. self.Layout()
  54. # end wxGlade
  55.  
  56. def new_game(self, event): # wxGlade: Main.<event_handler>
  57. wx.Frame("frame_2").Show(True)

I try to show a frame in the function new_game,
but I can't fin a way I tried self.frame_2.Show, etc... but it seems that wxglade does not declare self.frame_1 = wx.Frame(...) ; self.frame_2 = wx.Frame(...)

PS: the hierarchy in wxglade:
Application
- frame_1(Main)
> ....
> ....
- frame_2(Main)
> ...
Last edited by Kruptein; 28 Days Ago at 7:11 am.
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 84
Reputation: Kruptein is an unknown quantity at this point 
Solved Threads: 5
Kruptein's Avatar
Kruptein Kruptein is offline Offline
Junior Poster in Training
 
0
  #7
28 Days Ago
Okay I made the second frame an other class and I was able to show the second Frame as followed:
  1. def new_game(self, event): # wxGlade: Main.<event_handler>
  2. Main(self,-1).Show(False)
  3. Game(self,-1).Show(True)

the Game window shows, but the Main window does not hide.
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 84
Reputation: Kruptein is an unknown quantity at this point 
Solved Threads: 5
Kruptein's Avatar
Kruptein Kruptein is offline Offline
Junior Poster in Training
 
0
  #8
28 Days Ago
Okay I was able to solve it with
Main.Hide(self)
Last edited by Kruptein; 28 Days Ago at 8:31 am.
Reply With Quote Quick reply to this message  
Join Date: Nov 2009
Posts: 41
Reputation: ShadyTyrant is an unknown quantity at this point 
Solved Threads: 8
ShadyTyrant's Avatar
ShadyTyrant ShadyTyrant is offline Offline
Light Poster
 
0
  #9
28 Days Ago
Congrads on figuring it out with out any help.
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 84
Reputation: Kruptein is an unknown quantity at this point 
Solved Threads: 5
Kruptein's Avatar
Kruptein Kruptein is offline Offline
Junior Poster in Training
 
0
  #10
28 Days Ago
Yeah, I wanted to find it quickly, but on the internet there wasn't much help.
So I kept doing things until I finally found it
Reply With Quote Quick reply to this message  
Reply

Message:



Similar Threads
Other Threads in the Python Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC