# File: Manager.py

from Tkinter import *

class Manager:
    def choose(self,master):

	Label(tasksf, text="Task ID:").grid(row=0,column=0,padx=3,pady=3)
	Label(tasksf, text="Description:").grid(row=1,column=0,padx=3,pady=3)
	Label(tasksf, text="Start Date:").grid(row=2,column=0,padx=3,pady=3)
	Label(tasksf, text="Deadline:").grid(row=3,column=0,padx=3,pady=3)

    def asdfg(self,master):
	print "dsgsfd ",v

    def __init__(self,master):
	v = IntVar()
	Radiobutton(menuf, text="Tasks", variable=v,indicatoron=0, value=11,command=self.choose(master)).grid(row=0,column=0,padx=5,pady=5,ipadx=5,ipady=5)
	Radiobutton(menuf, text="Meeting", variable=v,indicatoron=0, value=22,command=self.asdfg(master)).grid(row=0,column=1,padx=5,pady=5,ipadx=5,ipady=5)
	Radiobutton(menuf, text="Profiles", variable=v,indicatoron=0, value=33,command=self.asdfg(master)).grid(row=0,column=2,padx=5,pady=5,ipadx=5,ipady=5)

	print "var ",v
   # def validate(self):

root = Tk()
app = Manager(root)

I am quite new to python and am having some problem with it regarding the GUI portion. I am using TkInter module for the GUI. I am using it for a project. When you run the above the program you get to see a entire frame at one go, whereas what i am trying for is that the "tasks" button is pressed, the textboxes nad labels appear in a different frame connected to current frame. I used the 'command' option for callback function but it seems to running like a normal function with 'textboxes' frame showing before the "tasks" button is pressed.

The 'print' statements were for debugging purpose only but to no avail..

Please Help

You have two problems:
1. Your code is all over the place
2. Your binding everything to the same window.

1. With your class, you should call root = Tk() inside the __init__ function, this also means that root.mainloop() should go at the end of the __init__ function. Also, I would recommend reordering the code in a more logical order. Because all your functions are in a class, you can ignore the problem of having to declare a function before calling it.

2. You are using two frames, but they are on the same window - root. They will automatically be combined and placed inside the same window. If you want them to be seperate, I suggest having either a second full class (with __init__ function) or a seperate function. Within this, you should call root = Tk() again, to create another window. It may not be exactly what you want, but it'll do for now.

I am making a series of Python and Tkinter tutorials on youtube, including one of the use of classes. Here is my channel:

I hope this helps. :)

Be a part of the DaniWeb community

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