Guys, I just started tinkering with Python in a GUI enviorment. But I have a question.
I a using wx-glade, and it says I can't touch the code between:

# begin wxGlade: extracode
# end wxGlade

Here is my code:

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# generated by wxGlade 0.6.3 on Mon Dec 13 14:00:23 2010


import wx
import math

# begin wxGlade: extracode
# end wxGlade



class MyFrame5(wx.Frame):
    def __init__(self, *args, **kwds):
        # begin wxGlade: MyFrame5.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.label_2 = wx.StaticText(self, -1, "a:", style=wx.ALIGN_RIGHT)
        self.txt_a = wx.TextCtrl(self, -1, "")
        self.label_2_copy = wx.StaticText(self, -1, "b:", style=wx.ALIGN_RIGHT)
        self.text_ctrl_4 = wx.TextCtrl(self, -1, "")
        self.label_2_copy_1 = wx.StaticText(self, -1, "c:", style=wx.ALIGN_RIGHT)
        self.text_ctrl_5 = wx.TextCtrl(self, -1, "")
        self.label_3 = wx.StaticText(self, -1, "Perimeter:", style=wx.ALIGN_RIGHT)
        self.text_ctrl_6 = wx.TextCtrl(self, -1, "")
        self.label_4 = wx.StaticText(self, -1, "Area:", style=wx.ALIGN_RIGHT)
        self.text_ctrl_7 = wx.TextCtrl(self, -1, "")
        self.button_1 = wx.Button(self, -1, "Calculate Area", style=wx.BU_RIGHT)

        self.__set_properties()
        self.__do_layout()
        # end wxGlade

    def __set_properties(self):
        # begin wxGlade: MyFrame5.__set_properties
        self.SetTitle("frame_6")
        self.txt_a.SetMinSize((160, 27))
        self.text_ctrl_4.SetMinSize((160, 27))
        self.text_ctrl_5.SetMinSize((160, 27))
        self.text_ctrl_6.SetMinSize((160, 27))
        self.text_ctrl_7.SetMinSize((160, 27))
        self.button_1.SetMinSize((107, 29))
        # end wxGlade

    def __do_layout(self):
        # begin wxGlade: MyFrame5.__do_layout
        grid_sizer_1 = wx.GridSizer(10, 2, 0, 0)
        grid_sizer_1.Add(self.label_2, 0, wx.ALIGN_RIGHT, 4)
        grid_sizer_1.Add(self.txt_a, 0, 0, 0)
        grid_sizer_1.Add(self.label_2_copy, 0, wx.ALIGN_RIGHT, 4)
        grid_sizer_1.Add(self.text_ctrl_4, 0, 0, 0)
        grid_sizer_1.Add(self.label_2_copy_1, 0, wx.ALIGN_RIGHT, 4)
        grid_sizer_1.Add(self.text_ctrl_5, 0, 0, 0)
        grid_sizer_1.Add(self.label_3, 0, 0, 0)
        grid_sizer_1.Add(self.text_ctrl_6, 0, 0, 0)
        grid_sizer_1.Add(self.label_4, 0, 0, 0)
        grid_sizer_1.Add(self.text_ctrl_7, 0, 0, 0)
        grid_sizer_1.Add(self.button_1, 0, 0, 0)
        self.SetSizer(grid_sizer_1)
        grid_sizer_1.Fit(self)
        self.Layout()
        # end wxGlade

# end of class MyFrame5


if __name__ == "__main__":
    app = wx.PySimpleApp(0)
    wx.InitAllImageHandlers()
    frame_6 = MyFrame5(None, -1, "")
    app.SetTopWindow(frame_6)
    frame_6.Show()
    app.MainLoop()

QUESTION: Where it says:

self.txt_a = wx.TextCtrl(self, -1, "")

I want to put that into a variable called 'a'. But it is inside the "don't touch" code.
What do I do?

I dont see why you cant change that. You extended the wx.Frame class so you can overide methods and variables in your calss if you want.

The only problem i see is your gridsizer not well coded hence breaks apart when expanded.

;)

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.