How do I put in default values in my def textbox code attached -

if you are using wx then just go:

text.SetValue("Default Value Here")

Where text is your wx.TextCtrl

i set up the text box like this - so how to do as you said?

self.inputTxtThree = self.textbox('Starting at what hour? 6? 24 hr clock-\n or immediate start just accept 99.','99', bmp)



def textbox(self, label_str, default_value= "99", bmp = None):
		if bmp:
			bitmap = wx.StaticBitmap(self.panel, wx.ID_ANY, bmp)
			
		#label = wx.StaticText(self.panel,wx.ID_ANY, label_str,style=wx.TE_MULTILINE)
		label = wx.StaticText(self.panel,wx.ID_ANY, label_str)
		tbox = wx.TextCtrl(self.panel, wx.ID_ANY,size=(55, -1))
		input_sizer   = wx.BoxSizer(wx.HORIZONTAL)
		input_sizer.Add((20,20), proportion=-1)  # this is a spacer
		if bmp:
			input_sizer.Add(bitmap, 0, wx.ALL, 5)
		input_sizer.Add(label, 0, wx.ALL|wx.ALIGN_RIGHT, 0,wx.TE_DONTWRAP)
		#self.gridSizer.Add(input_sizer, 1, wx.ALIGN_RIGHT, wx.TE_DONTWRAP)
		self.gridSizer.Add(input_sizer, 1, wx.ALIGN_RIGHT, wx.TE_DONTWRAP)

		self.gridSizer.Add(tbox, 0)
		return tbox

This will do the adding of the default value:

self.inputTxtThree = self.textbox('Starting at what hour? 6? 24 hr clock-\n or immediate start just accept 99.','99', bmp)



def textbox(self, label_str, default_value= "99", bmp = None):
		if bmp:
			bitmap = wx.StaticBitmap(self.panel, wx.ID_ANY, bmp)
			
		#label = wx.StaticText(self.panel,wx.ID_ANY, label_str,style=wx.TE_MULTILINE)
		label = wx.StaticText(self.panel,wx.ID_ANY, label_str)
		tbox = wx.TextCtrl(self.panel, wx.ID_ANY,size=(55, -1))
                tbox.SetValue(default_value)
		input_sizer   = wx.BoxSizer(wx.HORIZONTAL)
		input_sizer.Add((20,20), proportion=-1)  # this is a spacer
		if bmp:
			input_sizer.Add(bitmap, 0, wx.ALL, 5)
		input_sizer.Add(label, 0, wx.ALL|wx.ALIGN_RIGHT, 0,wx.TE_DONTWRAP)
		#self.gridSizer.Add(input_sizer, 1, wx.ALIGN_RIGHT, wx.TE_DONTWRAP)
		self.gridSizer.Add(input_sizer, 1, wx.ALIGN_RIGHT, wx.TE_DONTWRAP)

		self.gridSizer.Add(tbox, 0)
		return tbox

yes thats done it

PERFECT!!!!!
Thank you

just mark it as solved.

Just a note to jloyzaga, please do not use tabs for indents! Makes your code look rather nasty.

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.