I am learning how to use Tkinter to make GUI apps and I can not figure out why I can not pass a width and height argument through my class __init__ function.
Edit: Sorry, got excited. What it's doing is telling me that I'm passing too many arguments. And no matter how I rearrange the parameters of the class __init__ and Frame __init__, nothing changes. It's either too many, or not enough.
Edit_2: Alright, this runs without error. But it's still not resizing the frame.
Here is what I am working with.:
#!/usr/bin/python
from Tkinter import *
class App(Frame):
def __init__(self, parent, width, height):
Frame.__init__(self, parent)
self.parent = parent
self.width = width
self.height = height
self.initUI()
def initUI(self):
self.parent.title("App")
self.grid()
def main():
root = Tk()
app = App(root, 300, 250)
root.mainloop()
if __name__ == '__main__':
main()
rootis main window) or frame size. But usinself.widthwill not change frame size. You have to useself.config(width=new_width)