On Thu, 11 May 2006 11:07:27 +0000
"Peter Lacroix" <[EMAIL PROTECTED]> wrote:

> Hi all,
> 
> Let's say you had the following class below (MakeChoice) that was used to 
> cast a vote. When the program is running, eventually the user will confirm 
> choices made through some sort of "SUBMIT" button. When that button is 
> clicked, we want the selected value (on a few sets of radio buttons) to be 
> written to a file. What is the container of the currently selected value and 
> how does one have that value be written to a file when a button is clicked?
> 

Hi Peter,

do you mean something like this:

def create_widgets(self):
    (... snip ...)
    self.submit_button = Button(self, text='Submit', command=self.submit)
    self.submit_button.grid(row=8, column=0)

def submit(self):
    f = open(your_filename_here, 'w')
    f.write(self.current_selection_get())
    f.close()

The value of the StringVar is updated automatically each time the user changes 
the selection.

I hope this helps

Michael

_______________________________________________
Tkinter-discuss mailing list
[email protected]
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to