0
votes

I have child window named "zarzad" I made in it QtabWidget with two tabs named "Dane" and "Other". In Tab "Dane" I put some Qlabel. How in code I can put text into this QLabel. I use command: self.zarzad.QtabWidget.Dane.Qlabel.setText("string")

But I receive error :

self.zarzad.QTabWidget.Dane.Qlabel.setText("string") AttributeError: 'QTabWidget' object has no attribute 'Dane'

Dane is the name of the tab. In my logic it should work: 1 open window zarzad 2 open QTabWidget 3 in this QTabWidget open tab - named "Dane" 4 open in the in this tab Qlabel 5 set the text to this label How I should write this to set the label text. What I doing wrong?

1

1 Answers

0
votes

After many hours of guessing and I found solution.

self.zarzad.Qlabel.setText("string)

I was thinking that I need to mark in which tab it is the Qlabel but it is enough if I give name of child window (here is "zarzad") and then skip Tab name (here "Dane") and put Qlabel name (here "Qlabel") and then .setText("string")

So this will sort the problem.

If for other hand you would like to get text from Qlabel in the tab you just write instead of .setText("string") to .text()