For a beginner in Tkinter, and just average in Python, it's hard to find proper stuff on tkinter. Here is the problem I met (and begin to solve). I think Problem came from python version.
I'm trying to do a GUI, in OOP, and I got difficulty in combining different classes.
Let say I have a "small box" (for example, a menu bar), and in want to put it in a "big box". Working from this tutorial (http://sebsauvage.net/python/gui/index.html), I'm trying the following code
#!usr/bin/env python3.5
# coding: utf-8
import tkinter as tki
class SmallBox(tki.Tk):
def __init__(self,parent):
tki.Tk.__init__(self,parent)
self.parent = parent
self.grid()
self.box = tki.LabelFrame(self,text="small box")
self.box.grid()
self.graphicalStuff = tki.Entry(self.box) # something graphical
self.graphicalStuff.grid()
class BigBox(tki.Tk):
def __init__(self,parent):
tki.Tk.__init__(self,parent)
self.parent = parent
self.grid()
self.box = tki.LabelFrame(self,text='big box containing the small one')
self.graphStuff = tki.Entry(self.box) # something graphical
self.sbox = SmallBox(self)
self.graphStuff.grid()
self.box.grid()
self.sbox.grid()
But I got the following error.
File "/usr/lib/python3.5/tkinter/__init__.py", line 1871, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
TypeError: create() argument 1 must be str or None, not BigBox