Sie sind nicht angemeldet.

1

02.09.2018, 17:02

Python oder Python-Code wo ist der Fehler?

Ich erstelle gerade ein Python Programm. Ich bekomme einen Fehler den ich nicht zuordnen kann. Es sieht nach nem Fehler im simpledialog aus. Also nicht in meinem Code ... ??
Bitte helft mir mal.

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from tkinter import Tk, simpledialog, messagebox
def datei_lesen():
                with open ('../../../../home/fridolin/python/uebersetzung/uebersetzung.txt') as file:
                                for line in file:
                                                line=line.rstrip('\n')
                                                vokabel, uebersetzung = line.split('/')
                                                #lexikon[vokabel]=uebersetzung
def datei_schreiben(vokabel_name, uebersetzung_name):
                with open ('../../../../home/fridolin/python/uebersetzung/uebersetzung.txt','a') as file:
                                file.write('\n' + vokabel_name + '/' + uebersetzung_name)

datei_lesen()

while True:
                abfrage_vokabel=simpledialog.askstring('Vokabel','Gib die Vokabel ein:')
                
print("Übersetze eine Häkelanleitung. Gib den Text ein. ")
root=Tk()
root.withdraw()
dictonary={'sc':'fM'}


Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
=========== RESTART: /home/fridolin/python/tkinter/uebersetzung.py ===========
Traceback (most recent call last):
  File "/home/fridolin/python/tkinter/uebersetzung.py", line 15, in <module>
    abfrage_vokabel=simpledialog.askstring('Vokabel','Gib die Vokabel ein:')
  File "/usr/lib64/python3.6/tkinter/simpledialog.py", line 392, in askstring
    d = _QueryString(title, prompt, **kw)
  File "/usr/lib64/python3.6/tkinter/simpledialog.py", line 370, in __init__
    _QueryDialog.__init__(self, *args, **kw)
  File "/usr/lib64/python3.6/tkinter/simpledialog.py", line 271, in __init__
    Dialog.__init__(self, parent, title)
  File "/usr/lib64/python3.6/tkinter/simpledialog.py", line 137, in __init__
    if parent.winfo_viewable():
AttributeError: 'NoneType' object has no attribute 'winfo_viewable'
>>>
Man kann nicht alles wissen, aber alles lernen!

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »monsterherz« (20.09.2018, 17:57)


2

13.11.2018, 12:50

Hi,

ich habe ein example von hier getestet,http://interactivepython.org/runestone/s…alog_boxes.html

und hatte keine Probleme.
Ich habe zwar angefangen mich in Python einzulesen, aber bei GUI bin ich noch nicht angelangt.
knasan

- Bug oder Feature, das darf man sich hier aussuchen. -