2016-09-16 7 views
1

私はPython 2.7でTkinterを使用してフレームを作成しており、別の背景を取得しています!フレームの背景を変更する方法 - Tkinter!

_tkinter.TclError: unknown option "-bg" 

と完全なトレースバック:

Traceback (most recent call last): 
    File "//MCLSERVER4/MCL Sicherung/M.Grbic/Python/Power Cycling Test/pwrMultiCycling.py", line 26, in <module> 
    gui = Interface(root) 
    File "//MCLSERVER4/MCL Sicherung/M.Grbic/Python/Power Cycling Test/pwrMultiCycling.py", line 20, in __init__ 
    self.frame = Frame(parent, bg='', colormap='new') 
    File "S:\Python27\lib\lib-tk\ttk.py", line 735, in __init__ 
    Widget.__init__(self, master, "ttk::frame", kw) 
    File "S:\Python27\lib\lib-tk\ttk.py", line 555, in __init__ 
    Tkinter.Widget.__init__(self, master, widgetname, kw=kw) 
    File "S:\Python27\lib\lib-tk\Tkinter.py", line 2036, in __init__ 
    (widgetName, self._w) + extra + self._options(cnf)) 
_tkinter.TclError: unknown option "-bg" 

と私のコード:

from Tkinter import * 
from ttk import * 
import os 
from PIL import Image 

class Interface: 

    def __init__(self, parent): 
     self.parent = parent 
     parent.title("") 
     local_directory = os.path.dirname(os.path.realpath(__file__)) 
     self.dataname = "/does/not/exist" 

     self.frame = Frame(parent, bg='', colormap='new') 



if __name__ == '__main__': 
    root = Tk() 
    gui = Interface(root) 
    root.mainloop() 
+2

危険性*の輸入品です。その解決策tkとttkで –

+0

私は私の問題を解決することはできません。 –

答えて

1

は、私が思うに、私は解決策を持って、私はこのコードを使用する場合しかし、それは次のエラーを与えます私の問題は次のようになります:

import Tkinter 
from ttk import * 
import os 

    class Interface: 

     def __init__(self, parent): 
      self.parent = parent 
      parent.title("") 

      self.frame = Tkinter.Frame(parent, bg='', colormap='new') 


    if __name__ == '__main__': 
     root = Tkinter.Tk() 
     gui = Interface(root) 
     root.mainloop() 
関連する問題