ok below code is v rough but first implementation in python.
i get the error
name error name self is not defined in relation to teh first use of self.panelL in the layout function?

it was working then i tried adding a button and it stopped I removed the button code and I got a different error?

the error message is less than useful. self is called in at the function start and my example code still works?

id like to know what the problem is so i can fix it in future?

"""
portable menu application written in python.
"""

__author__     = "adam Buxton"
__version__    = "0.1"
#imports
from wxPython.wx import * #import the GUI
import wx
from win32gui import GetDesktopWindow,GetWindowRect # windows methods to find desktop dimensions.
from calcMem import * #import python script for memory function
import os 

TITLE    = "python portable menu"
ID_ABOUT = wx.NewId()
ID_EXIT  = wx.NewId()

class menuFrame(wxFrame):
	def __init__(self, parent, ID, title):
       
		hDesk = GetDesktopWindow()
		(dL,dT,dR,dB) = GetWindowRect(hDesk)
		
		wxFrame.__init__(self, parent, ID, title,(dR-(dR/3),dB-(dB/3)*2),wx.Size(dR/3, ((dB/3)*2)-30))
		self.CreateStatusBar()
		self.SetStatusText(compFreeSpace()+' Free Space of '+compTotalSpace())
		FileMenu = wx.Menu()
		FileMenu.Append(ID_EXIT,
			"E&xit",
			"Terminate the program")
		HelpMenu = wx.Menu()
		HelpMenu.Append(ID_ABOUT,"&About","Portable menu developed in python")
		menuBar = wx.MenuBar()
		menuBar.Append(FileMenu, "&File")
		menuBar.Append(HelpMenu, "&Help")
		self.SetMenuBar(menuBar)
		
		#panels for layout
		panelL = wx.Panel(self)
		panelRt = wx.Panel(self)
		panelRb = wx.Panel(self)
		self.__do_layout()
		
	def __do_layout(self):
		sizer = wx.BoxSizer(wx.VERTICAL)
        grid_sizer = wx.GridSizer(1, 2, 0, 0)
        grid_sizerR = wx.GridSizer(2, 1, 0, 0)
        grid_sizer.Add(self.panelL, 1, wx.EXPAND, 0)
        grid_sizerR.Add(self.panelRt, 1, wx.EXPAND, 0)
        grid_sizerR.Add(self.panelRb, 1, wx.EXPAND, 0)
        grid_sizer.Add(grid_sizerR, 1, wx.EXPAND, 0)
        sizer.Add(grid_sizer, 1, wx.EXPAND, 0)
        self.SetSizer(sizer)
        sizer_1.Fit(self)
        self.Layout()
        
	


		
	
	
class menuApp(wxApp):
#menu app its self with constrcutors

    def OnInit(self):
        frame = menuFrame(NULL, -1, TITLE)
        frame.Show(true)
        self.SetTopWindow(frame)
        return true

#main looop to run program
app = menuApp(0)
app.MainLoop()

Hmm... I'm getting a different set of messages:

Warning (from warnings module):
  File "C:/Python25/menuapp.py", line 8
    from wxPython.wx import * #import the GUI
DeprecationWarning: The wxPython compatibility package is no longer automatically generated or actively maintained.  Please switch to the wx package as soon as possible.

Traceback (most recent call last):
  File "C:/Python25/menuapp.py", line 8, in <module>
    from wxPython.wx import * #import the GUI
  File "C:\Python25\lib\site-packages\wx-2.8-msw-unicode\wxPython\__init__.py", line 15, in <module>
    import _wx
  File "C:\Python25\lib\site-packages\wx-2.8-msw-unicode\wxPython\_wx.py", line 8, in <module>
    from _misc import *
  File "C:\Python25\lib\site-packages\wx-2.8-msw-unicode\wxPython\_misc.py", line 456, in <module>
    wxDateTime_GetNumberOfDaysinYear = wx._misc.DateTime_GetNumberOfDaysinYear
AttributeError: 'module' object has no attribute 'DateTime_GetNumberOfDaysinYear'

When I tried to fix the warning by commenting out "from wxPython.wx import *", I got the message

Traceback (most recent call last):
  File "C:/Python25/menuapp.py", line 10, in <module>
    from wx.win32gui import GetDesktopWindow,GetWindowRect # windows methods to find desktop dimensions.
ImportError: No module named win32gui

Are you trying to piece this together from older code somewhere?

Jeff

im piecing it together from orielly python book, and the wx wiki and help file?
mine works up to the point i enter the panel?

ill try amend all the import to the
import XXXXX type and see what happens from there?

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.