| | |
several questions about Glade & pygtk
Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
![]() |
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.
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.
0
#3 Nov 6th, 2009
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/
0
#4 Nov 6th, 2009
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
so wxpython is better supported on both windows and linux?
I will give it a try
0
#6 Nov 7th, 2009
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.
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)
> ...
but now I have one problem, I can't find a way to hide my Frame and show an other frame.
Python Syntax (Toggle Plain Text)
class Main(wx.Frame): def __init__(self, *args, **kwds): # begin wxGlade: Main.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.p1name = wx.StaticText(self, -1, "Player 1 Name:", style=wx.ALIGN_CENTRE) self.p1entry = wx.TextCtrl(self, -1, "") self.p2name = wx.StaticText(self, -1, "Player 2 Name:", style=wx.ALIGN_CENTRE) self.p2entry = wx.TextCtrl(self, -1, "") self.moneystart = wx.StaticText(self, -1, "Money:", style=wx.ALIGN_CENTRE) self.moneyentry = wx.TextCtrl(self, -1, "") self.newgamebutton = wx.Button(self, -1, "start new game") self.newgameinfo = wx.StaticText(self, -1, "Money: the ammount of\n money each player gets\n at the start") # Menu Bar self.menubar = wx.MenuBar() wxglade_tmp_menu = wx.Menu() wxglade_tmp_menu.Append(wx.NewId(), "New", "", wx.ITEM_NORMAL) wxglade_tmp_menu.Append(wx.NewId(), "open", "", wx.ITEM_NORMAL) self.menubar.Append(wxglade_tmp_menu, "File") wxglade_tmp_menu = wx.Menu() self.menubar.Append(wxglade_tmp_menu, "Help") self.SetMenuBar(self.menubar) # Menu Bar end self.__set_properties() self.__do_layout() self.Bind(wx.EVT_BUTTON, self.new_game, self.newgamebutton) self.Bind(wx.EVT_MENU, self.new_game, id=-1) # end wxGlade def __set_properties(self): # begin wxGlade: Main.__set_properties self.SetTitle("frame_1") # end wxGlade def __do_layout(self): # begin wxGlade: Main.__do_layout sizer_1 = wx.BoxSizer(wx.VERTICAL) grid_sizer_1 = wx.GridSizer(4, 2, 0, 0) grid_sizer_1.Add(self.p1name, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0) grid_sizer_1.Add(self.p1entry, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0) grid_sizer_1.Add(self.p2name, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0) grid_sizer_1.Add(self.p2entry, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0) grid_sizer_1.Add(self.moneystart, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0) grid_sizer_1.Add(self.moneyentry, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0) grid_sizer_1.Add(self.newgamebutton, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0) grid_sizer_1.Add(self.newgameinfo, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0) sizer_1.Add(grid_sizer_1, 1, wx.EXPAND, 0) self.SetSizer(sizer_1) sizer_1.Fit(self) self.Layout() # end wxGlade def new_game(self, event): # wxGlade: Main.<event_handler> 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; Nov 7th, 2009 at 7:11 am.
0
#7 Nov 7th, 2009
Okay I made the second frame an other class and I was able to show the second Frame as followed:
the Game window shows, but the Main window does not hide.
Python Syntax (Toggle Plain Text)
def new_game(self, event): # wxGlade: Main.<event_handler> Main(self,-1).Show(False) Game(self,-1).Show(True)
the Game window shows, but the Main window does not hide.
0
#8 Nov 7th, 2009
Okay I was able to solve it with
Main.Hide(self) Last edited by Kruptein; Nov 7th, 2009 at 8:31 am.
0
#10 Nov 7th, 2009
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
So I kept doing things until I finally found it
![]() |
Similar Threads
- I have 2 questions about php & apache (Kernels and Modules)
- Questions for SEO's & Moderators (Search Engine Optimization)
- Questions about Hosting & Potentially Looking for a New Hosting Company (Web Hosting Deals)
- GUI for Python (Python)
Other Threads in the Python Forum
- Previous Thread: I require help with making 3 simple program/functions
- Next Thread: find string in file
Views: 267 | Replies: 9
| Thread Tools | Search this Thread |
Tag cloud for Python
anti approximation array avogadro beginner builtin cipher clear client code color converter countpasswordentry cturtle curved def dictionary drive dynamic examples excel file float format frange ftp function gui homework import input java lapse library line lines linux list lists loop microcontroller mouse multiple mysqldb mysqlquery newb number numbers output parsing path port prime program programming projects py2exe pygame pymailer pyqt python random recursion recursive redirect script scrolledtext singleton socket sqlite ssh stderr string strings subprocess sum syntax table terminal text textarea thread threading time tkinter tlapse tuple tutorial twoup ubuntu unicode unix urllib urllib2 variable web-scrape wikipedia windows word wxpython






