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.

Recommended Answers

All 9 Replies

I hope you have luck finding someone who actually uses pygtk. I run on a Windows platform and pygtk is a bear to install.

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/

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

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.

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.

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)
> ...

Okay I made the second frame an other class and I was able to show the second Frame as followed:

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.

Okay I was able to solve it with Main.Hide(self)

Congrads on figuring it out with out any help.

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 :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.