AttributeError: 'super' object has no attribute '__getattr__' when trying to add a widget to a personalized id of LayoutAttributeError: 'module' object has no attributepython kivy AttributeError: 'super' object has no attribute '__getattr__'Python - Kivy: AttributeError: 'super' object has no attribute '__getattr__' when trying to get self.idsscreen manager (AttributeError: 'super' object has no attribute '__getattr__')Kivy AttributeError: 'super' object has no attribute '__getattr__' with ScreenManagerAttributeError: 'super' object has no attribute '__getattr__'Python/Kivy AttributeError: 'super' object has no attribute '__getattr__''super' object has no attribute '__getattr__' kivyAttributeError: 'super' object has no attribute '__getattr__' Error when using BoxLayout with several kv-files in Kivy
Popcorn is the only acceptable snack to consume while watching a movie
Does the unit of measure matter when you are solving for the diameter of a circumference?
Simple fuzz pedal using breadboard
Is it possible to build VPN remote access environment without VPN server?
At what point in European history could a government build a printing press given a basic description?
How can I tell if I'm being too picky as a referee?
Find limit in use of integrals
Should one buy new hardware after a system compromise?
Is the Starlink array really visible from Earth?
I unknowingly submitted plagarised work
Which is the common name of Mind Flayers?
Grammar Question Regarding "Are the" or "Is the" When Referring to Something that May or May not be Plural
Is real public IP Address hidden when using a system wide proxy in Windows 10?
What is the largest (size) solid object ever dropped from an airplane to impact the ground in freefall?
keyval - function for keyB should act dependent on value of keyA - how to do this?
Crossing US border with music files I'm legally allowed to possess
Where is the logic in castrating fighters?
Why colon to denote that a value belongs to a type?
Compactness of finite sets
What is quasi-aromaticity?
Did people go back to where they were?
Would jet fuel for an F-16 or F-35 be producible during WW2?
Is there a way to make it so the cursor is included when I prtscr key?
Line of lights moving in a straight line , with a few following
AttributeError: 'super' object has no attribute '__getattr__' when trying to add a widget to a personalized id of Layout
AttributeError: 'module' object has no attributepython kivy AttributeError: 'super' object has no attribute '__getattr__'Python - Kivy: AttributeError: 'super' object has no attribute '__getattr__' when trying to get self.idsscreen manager (AttributeError: 'super' object has no attribute '__getattr__')Kivy AttributeError: 'super' object has no attribute '__getattr__' with ScreenManagerAttributeError: 'super' object has no attribute '__getattr__'Python/Kivy AttributeError: 'super' object has no attribute '__getattr__''super' object has no attribute '__getattr__' kivyAttributeError: 'super' object has no attribute '__getattr__' Error when using BoxLayout with several kv-files in Kivy
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
when trying to add a widget (a layout in the problem) to a personalized id that i modify to the layout it launchs me an error that i believe that i does not identify the id personalized
gr_ly = GridLayout(id=i[1], rows=1)
self.LayoutGeneralCI.ids.realll.add_widget(gr_ly)
#Adding another widget to the custom id layout but just always puts me the widgets into the last layout executed
gr_ly.add_widget(self.DatosLayoutCI)
Here all the code
def selection_data_secciones(self):
self.mainwid.dataBase = sqlite3.connect("UserData")
self.mainwid.dataCursor = self.mainwid.dataBase.cursor()
self.mainwid.dataCursor.execute("SELECT * FROM SECCIONES")
fetch = self.mainwid.dataCursor.fetchall()
for i in fetch:
self.LayoutGeneralCI = LayoutGeneralCI(self.mainwid)
ref_idd = i[1]
gr_ly = GridLayout(id=i[1], rows=1)
print(type(gr_ly.id))
self.LayoutGeneralCI.ids.realll.add_widget(gr_ly)
print(self.LayoutGeneralCI.ids)
self.LayoutGeneralCI.ids.title_sect_lbl.text = i[1]
self.ids.container_ci.add_widget(self.LayoutGeneralCI)
for produ in self.mainwid.dataCursor.execute("SELECT * FROM MATERIALES"):
self.DatosLayoutCI = DatosLayoutCI(self.mainwid)
txtvar_ci = "Nombre: [b][/b] n".format(produ[1])
txtvar2_ci = "Proveedor: [b][/b] n".format(produ[3])
if produ[8] <= str(0):
txtvar3_ci = "Disponibilidad: [color=#FF0000][b]Agotado[/b][/color]"
else:
txtvar3_ci = "Disponibilidad: [color=#00FF00][b]Disponible[/b][/color]"
txtvargeneral_ci = txtvar_ci + txtvar2_ci + txtvar3_ci
self.DatosLayoutCI.ids.content_cill.text = txtvargeneral_ci
var_sectttion = self.mainwid.AgregarProductos.ids.section_product.text#
var_reference_id = produ[2]
gr_ly.add_widget(self.DatosLayoutCI)
self.mainwid.dataBase.commit() #DISCOMMENT NECCESARY
self.mainwid.dataBase.close()
the results are:
self.LayoutGeneralCI.ids.var.add_widget(self.DatosLayoutCI)
File "kivyproperties.pyx", line 841, in kivy.properties.ObservableDict.__getattr__
AttributeError: 'super' object has no attribute '__getattr__'
python kivy
add a comment |
when trying to add a widget (a layout in the problem) to a personalized id that i modify to the layout it launchs me an error that i believe that i does not identify the id personalized
gr_ly = GridLayout(id=i[1], rows=1)
self.LayoutGeneralCI.ids.realll.add_widget(gr_ly)
#Adding another widget to the custom id layout but just always puts me the widgets into the last layout executed
gr_ly.add_widget(self.DatosLayoutCI)
Here all the code
def selection_data_secciones(self):
self.mainwid.dataBase = sqlite3.connect("UserData")
self.mainwid.dataCursor = self.mainwid.dataBase.cursor()
self.mainwid.dataCursor.execute("SELECT * FROM SECCIONES")
fetch = self.mainwid.dataCursor.fetchall()
for i in fetch:
self.LayoutGeneralCI = LayoutGeneralCI(self.mainwid)
ref_idd = i[1]
gr_ly = GridLayout(id=i[1], rows=1)
print(type(gr_ly.id))
self.LayoutGeneralCI.ids.realll.add_widget(gr_ly)
print(self.LayoutGeneralCI.ids)
self.LayoutGeneralCI.ids.title_sect_lbl.text = i[1]
self.ids.container_ci.add_widget(self.LayoutGeneralCI)
for produ in self.mainwid.dataCursor.execute("SELECT * FROM MATERIALES"):
self.DatosLayoutCI = DatosLayoutCI(self.mainwid)
txtvar_ci = "Nombre: [b][/b] n".format(produ[1])
txtvar2_ci = "Proveedor: [b][/b] n".format(produ[3])
if produ[8] <= str(0):
txtvar3_ci = "Disponibilidad: [color=#FF0000][b]Agotado[/b][/color]"
else:
txtvar3_ci = "Disponibilidad: [color=#00FF00][b]Disponible[/b][/color]"
txtvargeneral_ci = txtvar_ci + txtvar2_ci + txtvar3_ci
self.DatosLayoutCI.ids.content_cill.text = txtvargeneral_ci
var_sectttion = self.mainwid.AgregarProductos.ids.section_product.text#
var_reference_id = produ[2]
gr_ly.add_widget(self.DatosLayoutCI)
self.mainwid.dataBase.commit() #DISCOMMENT NECCESARY
self.mainwid.dataBase.close()
the results are:
self.LayoutGeneralCI.ids.var.add_widget(self.DatosLayoutCI)
File "kivyproperties.pyx", line 841, in kivy.properties.ObservableDict.__getattr__
AttributeError: 'super' object has no attribute '__getattr__'
python kivy
You have to add more code in this question, the other question will be automatically eliminated in the future so for future readers will not understand your question, the idea is that your question will not only serve you but the community now and from the future
– eyllanesc
Mar 25 at 3:44
add a comment |
when trying to add a widget (a layout in the problem) to a personalized id that i modify to the layout it launchs me an error that i believe that i does not identify the id personalized
gr_ly = GridLayout(id=i[1], rows=1)
self.LayoutGeneralCI.ids.realll.add_widget(gr_ly)
#Adding another widget to the custom id layout but just always puts me the widgets into the last layout executed
gr_ly.add_widget(self.DatosLayoutCI)
Here all the code
def selection_data_secciones(self):
self.mainwid.dataBase = sqlite3.connect("UserData")
self.mainwid.dataCursor = self.mainwid.dataBase.cursor()
self.mainwid.dataCursor.execute("SELECT * FROM SECCIONES")
fetch = self.mainwid.dataCursor.fetchall()
for i in fetch:
self.LayoutGeneralCI = LayoutGeneralCI(self.mainwid)
ref_idd = i[1]
gr_ly = GridLayout(id=i[1], rows=1)
print(type(gr_ly.id))
self.LayoutGeneralCI.ids.realll.add_widget(gr_ly)
print(self.LayoutGeneralCI.ids)
self.LayoutGeneralCI.ids.title_sect_lbl.text = i[1]
self.ids.container_ci.add_widget(self.LayoutGeneralCI)
for produ in self.mainwid.dataCursor.execute("SELECT * FROM MATERIALES"):
self.DatosLayoutCI = DatosLayoutCI(self.mainwid)
txtvar_ci = "Nombre: [b][/b] n".format(produ[1])
txtvar2_ci = "Proveedor: [b][/b] n".format(produ[3])
if produ[8] <= str(0):
txtvar3_ci = "Disponibilidad: [color=#FF0000][b]Agotado[/b][/color]"
else:
txtvar3_ci = "Disponibilidad: [color=#00FF00][b]Disponible[/b][/color]"
txtvargeneral_ci = txtvar_ci + txtvar2_ci + txtvar3_ci
self.DatosLayoutCI.ids.content_cill.text = txtvargeneral_ci
var_sectttion = self.mainwid.AgregarProductos.ids.section_product.text#
var_reference_id = produ[2]
gr_ly.add_widget(self.DatosLayoutCI)
self.mainwid.dataBase.commit() #DISCOMMENT NECCESARY
self.mainwid.dataBase.close()
the results are:
self.LayoutGeneralCI.ids.var.add_widget(self.DatosLayoutCI)
File "kivyproperties.pyx", line 841, in kivy.properties.ObservableDict.__getattr__
AttributeError: 'super' object has no attribute '__getattr__'
python kivy
when trying to add a widget (a layout in the problem) to a personalized id that i modify to the layout it launchs me an error that i believe that i does not identify the id personalized
gr_ly = GridLayout(id=i[1], rows=1)
self.LayoutGeneralCI.ids.realll.add_widget(gr_ly)
#Adding another widget to the custom id layout but just always puts me the widgets into the last layout executed
gr_ly.add_widget(self.DatosLayoutCI)
Here all the code
def selection_data_secciones(self):
self.mainwid.dataBase = sqlite3.connect("UserData")
self.mainwid.dataCursor = self.mainwid.dataBase.cursor()
self.mainwid.dataCursor.execute("SELECT * FROM SECCIONES")
fetch = self.mainwid.dataCursor.fetchall()
for i in fetch:
self.LayoutGeneralCI = LayoutGeneralCI(self.mainwid)
ref_idd = i[1]
gr_ly = GridLayout(id=i[1], rows=1)
print(type(gr_ly.id))
self.LayoutGeneralCI.ids.realll.add_widget(gr_ly)
print(self.LayoutGeneralCI.ids)
self.LayoutGeneralCI.ids.title_sect_lbl.text = i[1]
self.ids.container_ci.add_widget(self.LayoutGeneralCI)
for produ in self.mainwid.dataCursor.execute("SELECT * FROM MATERIALES"):
self.DatosLayoutCI = DatosLayoutCI(self.mainwid)
txtvar_ci = "Nombre: [b][/b] n".format(produ[1])
txtvar2_ci = "Proveedor: [b][/b] n".format(produ[3])
if produ[8] <= str(0):
txtvar3_ci = "Disponibilidad: [color=#FF0000][b]Agotado[/b][/color]"
else:
txtvar3_ci = "Disponibilidad: [color=#00FF00][b]Disponible[/b][/color]"
txtvargeneral_ci = txtvar_ci + txtvar2_ci + txtvar3_ci
self.DatosLayoutCI.ids.content_cill.text = txtvargeneral_ci
var_sectttion = self.mainwid.AgregarProductos.ids.section_product.text#
var_reference_id = produ[2]
gr_ly.add_widget(self.DatosLayoutCI)
self.mainwid.dataBase.commit() #DISCOMMENT NECCESARY
self.mainwid.dataBase.close()
the results are:
self.LayoutGeneralCI.ids.var.add_widget(self.DatosLayoutCI)
File "kivyproperties.pyx", line 841, in kivy.properties.ObservableDict.__getattr__
AttributeError: 'super' object has no attribute '__getattr__'
python kivy
python kivy
edited Mar 25 at 4:18
eyllanesc
93.4k123768
93.4k123768
asked Mar 24 at 5:03
Andrés Quiroz ValdovinosAndrés Quiroz Valdovinos
32
32
You have to add more code in this question, the other question will be automatically eliminated in the future so for future readers will not understand your question, the idea is that your question will not only serve you but the community now and from the future
– eyllanesc
Mar 25 at 3:44
add a comment |
You have to add more code in this question, the other question will be automatically eliminated in the future so for future readers will not understand your question, the idea is that your question will not only serve you but the community now and from the future
– eyllanesc
Mar 25 at 3:44
You have to add more code in this question, the other question will be automatically eliminated in the future so for future readers will not understand your question, the idea is that your question will not only serve you but the community now and from the future
– eyllanesc
Mar 25 at 3:44
You have to add more code in this question, the other question will be automatically eliminated in the future so for future readers will not understand your question, the idea is that your question will not only serve you but the community now and from the future
– eyllanesc
Mar 25 at 3:44
add a comment |
1 Answer
1
active
oldest
votes
Problem 2
Kept adding DatosLayoutCI widgets to the last widget, gr_ly
Solution
In order to display all the material (MATERIALES) under each section (SECCIONES), one has to use either one SQL statement with INNER JOIN or two SELECT statements (nested SELECTs).
Snippets - Nested SELECTs
def selection_data_secciones(self):
self.mainwid.dataBase = sqlite3.connect("UserData")
self.mainwid.dataCursor = self.mainwid.dataBase.cursor()
self.mainwid.dataCursor.execute("SELECT * FROM SECCIONES") # Sections
fetch = self.mainwid.dataCursor.fetchall()
for i in fetch:
self.LayoutGeneralCI = LayoutGeneralCI(self.mainwid)
ref_idd = i[1]
gr_ly = GridLayout(id=i[1], rows=1)
...
self.mainwid.dataCursor.execute("SELECT * FROM MATERIALES WHERE id=?", (gr_ly.id))
materials = self.mainwid.dataCursor.fetchall()
for produ in materials:
self.DatosLayoutCI = DatosLayoutCI(self.mainwid) # Datos = Data
...
gr_ly.add_widget(self.DatosLayoutCI)
self.mainwid.dataBase.commit() #DISCOMMENT NECCESARY
self.mainwid.dataBase.close()
Problem 1
self.LayoutGeneralCI.ids.var.add_widget(self.DatosLayoutCI)
File "kivyproperties.pyx", line 841, in kivy.properties.ObservableDict.__getattr__
AttributeError: 'super' object has no attribute '__getattr__'
Reason
The ids created in Python script is different from the ids created in the kv file.
Kivy Documentation
Kv Language » Referencing Widgets
Kv Language » Accessing Widgets defined inside Kv lang in your python code
Differences
kv file
- When assigning a value to id, remember that the value isn’t a string. There are no quotes: good ->
id: value
, bad ->id: 'value'
- Access it in Python script using
self.ids.realll
orself.ids['realll']
- When your kv file is parsed, kivy collects all the widgets tagged with id’s and places them in this
self.ids
dictionary type property. That means you can also iterate over these widgets and access them dictionary style.
py file
- The
id
is a string - Cannot access it using
self.ids.var
- Not stored in
self.ids
Solution
gr_ly = GridLayout(id=str(i[1]))
#####adding a widget to the personalized id of layout
gr_ly.add_widget(self.DatosLayoutCI)
self.LayoutGeneralCI.ids.realll.add_widget(gr_ly)
#######all the code is in a function so i want to créate a layout that will #######contain the widgets with a personalized id and then calling the #######personalized id to add the widget in different and specific layouts##
####defining the layout and it's personalized id and adding to the class
gr_ly = GridLayout(id=str(i[1]))
#####adding a widget to the personalized id of layout
gr_ly.add_widget(self.DatosLayoutCI)
self.LayoutGeneralCI.ids.realll.add_widget(gr_ly)#####1 PRIMERA OPCION
i tried that solution but the result is the same, the specific problem is that i want to add into the personalized layout widgets that have the same id as the layout, but trying this code when i run it always insert the layout on the final layout executed, another suggestion, please help
– Andrés Quiroz Valdovinos
Mar 24 at 17:18
If you are adding twogr_ly
then you have to executegr_ly.add_widget(self.DatosLayoutCI)
after instantiated eachgr_ly
.
– ikolim
Mar 24 at 21:43
i have added more code to a better understand of the problem, pelease check it and i hope you find an answer!, thanks
– Andrés Quiroz Valdovinos
Mar 25 at 4:14
please i need an answer
– Andrés Quiroz Valdovinos
Mar 26 at 0:50
Please refer to updated post.
– ikolim
Mar 26 at 15:29
|
show 2 more comments
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55320893%2fattributeerror-super-object-has-no-attribute-getattr-when-trying-to-add%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Problem 2
Kept adding DatosLayoutCI widgets to the last widget, gr_ly
Solution
In order to display all the material (MATERIALES) under each section (SECCIONES), one has to use either one SQL statement with INNER JOIN or two SELECT statements (nested SELECTs).
Snippets - Nested SELECTs
def selection_data_secciones(self):
self.mainwid.dataBase = sqlite3.connect("UserData")
self.mainwid.dataCursor = self.mainwid.dataBase.cursor()
self.mainwid.dataCursor.execute("SELECT * FROM SECCIONES") # Sections
fetch = self.mainwid.dataCursor.fetchall()
for i in fetch:
self.LayoutGeneralCI = LayoutGeneralCI(self.mainwid)
ref_idd = i[1]
gr_ly = GridLayout(id=i[1], rows=1)
...
self.mainwid.dataCursor.execute("SELECT * FROM MATERIALES WHERE id=?", (gr_ly.id))
materials = self.mainwid.dataCursor.fetchall()
for produ in materials:
self.DatosLayoutCI = DatosLayoutCI(self.mainwid) # Datos = Data
...
gr_ly.add_widget(self.DatosLayoutCI)
self.mainwid.dataBase.commit() #DISCOMMENT NECCESARY
self.mainwid.dataBase.close()
Problem 1
self.LayoutGeneralCI.ids.var.add_widget(self.DatosLayoutCI)
File "kivyproperties.pyx", line 841, in kivy.properties.ObservableDict.__getattr__
AttributeError: 'super' object has no attribute '__getattr__'
Reason
The ids created in Python script is different from the ids created in the kv file.
Kivy Documentation
Kv Language » Referencing Widgets
Kv Language » Accessing Widgets defined inside Kv lang in your python code
Differences
kv file
- When assigning a value to id, remember that the value isn’t a string. There are no quotes: good ->
id: value
, bad ->id: 'value'
- Access it in Python script using
self.ids.realll
orself.ids['realll']
- When your kv file is parsed, kivy collects all the widgets tagged with id’s and places them in this
self.ids
dictionary type property. That means you can also iterate over these widgets and access them dictionary style.
py file
- The
id
is a string - Cannot access it using
self.ids.var
- Not stored in
self.ids
Solution
gr_ly = GridLayout(id=str(i[1]))
#####adding a widget to the personalized id of layout
gr_ly.add_widget(self.DatosLayoutCI)
self.LayoutGeneralCI.ids.realll.add_widget(gr_ly)
#######all the code is in a function so i want to créate a layout that will #######contain the widgets with a personalized id and then calling the #######personalized id to add the widget in different and specific layouts##
####defining the layout and it's personalized id and adding to the class
gr_ly = GridLayout(id=str(i[1]))
#####adding a widget to the personalized id of layout
gr_ly.add_widget(self.DatosLayoutCI)
self.LayoutGeneralCI.ids.realll.add_widget(gr_ly)#####1 PRIMERA OPCION
i tried that solution but the result is the same, the specific problem is that i want to add into the personalized layout widgets that have the same id as the layout, but trying this code when i run it always insert the layout on the final layout executed, another suggestion, please help
– Andrés Quiroz Valdovinos
Mar 24 at 17:18
If you are adding twogr_ly
then you have to executegr_ly.add_widget(self.DatosLayoutCI)
after instantiated eachgr_ly
.
– ikolim
Mar 24 at 21:43
i have added more code to a better understand of the problem, pelease check it and i hope you find an answer!, thanks
– Andrés Quiroz Valdovinos
Mar 25 at 4:14
please i need an answer
– Andrés Quiroz Valdovinos
Mar 26 at 0:50
Please refer to updated post.
– ikolim
Mar 26 at 15:29
|
show 2 more comments
Problem 2
Kept adding DatosLayoutCI widgets to the last widget, gr_ly
Solution
In order to display all the material (MATERIALES) under each section (SECCIONES), one has to use either one SQL statement with INNER JOIN or two SELECT statements (nested SELECTs).
Snippets - Nested SELECTs
def selection_data_secciones(self):
self.mainwid.dataBase = sqlite3.connect("UserData")
self.mainwid.dataCursor = self.mainwid.dataBase.cursor()
self.mainwid.dataCursor.execute("SELECT * FROM SECCIONES") # Sections
fetch = self.mainwid.dataCursor.fetchall()
for i in fetch:
self.LayoutGeneralCI = LayoutGeneralCI(self.mainwid)
ref_idd = i[1]
gr_ly = GridLayout(id=i[1], rows=1)
...
self.mainwid.dataCursor.execute("SELECT * FROM MATERIALES WHERE id=?", (gr_ly.id))
materials = self.mainwid.dataCursor.fetchall()
for produ in materials:
self.DatosLayoutCI = DatosLayoutCI(self.mainwid) # Datos = Data
...
gr_ly.add_widget(self.DatosLayoutCI)
self.mainwid.dataBase.commit() #DISCOMMENT NECCESARY
self.mainwid.dataBase.close()
Problem 1
self.LayoutGeneralCI.ids.var.add_widget(self.DatosLayoutCI)
File "kivyproperties.pyx", line 841, in kivy.properties.ObservableDict.__getattr__
AttributeError: 'super' object has no attribute '__getattr__'
Reason
The ids created in Python script is different from the ids created in the kv file.
Kivy Documentation
Kv Language » Referencing Widgets
Kv Language » Accessing Widgets defined inside Kv lang in your python code
Differences
kv file
- When assigning a value to id, remember that the value isn’t a string. There are no quotes: good ->
id: value
, bad ->id: 'value'
- Access it in Python script using
self.ids.realll
orself.ids['realll']
- When your kv file is parsed, kivy collects all the widgets tagged with id’s and places them in this
self.ids
dictionary type property. That means you can also iterate over these widgets and access them dictionary style.
py file
- The
id
is a string - Cannot access it using
self.ids.var
- Not stored in
self.ids
Solution
gr_ly = GridLayout(id=str(i[1]))
#####adding a widget to the personalized id of layout
gr_ly.add_widget(self.DatosLayoutCI)
self.LayoutGeneralCI.ids.realll.add_widget(gr_ly)
#######all the code is in a function so i want to créate a layout that will #######contain the widgets with a personalized id and then calling the #######personalized id to add the widget in different and specific layouts##
####defining the layout and it's personalized id and adding to the class
gr_ly = GridLayout(id=str(i[1]))
#####adding a widget to the personalized id of layout
gr_ly.add_widget(self.DatosLayoutCI)
self.LayoutGeneralCI.ids.realll.add_widget(gr_ly)#####1 PRIMERA OPCION
i tried that solution but the result is the same, the specific problem is that i want to add into the personalized layout widgets that have the same id as the layout, but trying this code when i run it always insert the layout on the final layout executed, another suggestion, please help
– Andrés Quiroz Valdovinos
Mar 24 at 17:18
If you are adding twogr_ly
then you have to executegr_ly.add_widget(self.DatosLayoutCI)
after instantiated eachgr_ly
.
– ikolim
Mar 24 at 21:43
i have added more code to a better understand of the problem, pelease check it and i hope you find an answer!, thanks
– Andrés Quiroz Valdovinos
Mar 25 at 4:14
please i need an answer
– Andrés Quiroz Valdovinos
Mar 26 at 0:50
Please refer to updated post.
– ikolim
Mar 26 at 15:29
|
show 2 more comments
Problem 2
Kept adding DatosLayoutCI widgets to the last widget, gr_ly
Solution
In order to display all the material (MATERIALES) under each section (SECCIONES), one has to use either one SQL statement with INNER JOIN or two SELECT statements (nested SELECTs).
Snippets - Nested SELECTs
def selection_data_secciones(self):
self.mainwid.dataBase = sqlite3.connect("UserData")
self.mainwid.dataCursor = self.mainwid.dataBase.cursor()
self.mainwid.dataCursor.execute("SELECT * FROM SECCIONES") # Sections
fetch = self.mainwid.dataCursor.fetchall()
for i in fetch:
self.LayoutGeneralCI = LayoutGeneralCI(self.mainwid)
ref_idd = i[1]
gr_ly = GridLayout(id=i[1], rows=1)
...
self.mainwid.dataCursor.execute("SELECT * FROM MATERIALES WHERE id=?", (gr_ly.id))
materials = self.mainwid.dataCursor.fetchall()
for produ in materials:
self.DatosLayoutCI = DatosLayoutCI(self.mainwid) # Datos = Data
...
gr_ly.add_widget(self.DatosLayoutCI)
self.mainwid.dataBase.commit() #DISCOMMENT NECCESARY
self.mainwid.dataBase.close()
Problem 1
self.LayoutGeneralCI.ids.var.add_widget(self.DatosLayoutCI)
File "kivyproperties.pyx", line 841, in kivy.properties.ObservableDict.__getattr__
AttributeError: 'super' object has no attribute '__getattr__'
Reason
The ids created in Python script is different from the ids created in the kv file.
Kivy Documentation
Kv Language » Referencing Widgets
Kv Language » Accessing Widgets defined inside Kv lang in your python code
Differences
kv file
- When assigning a value to id, remember that the value isn’t a string. There are no quotes: good ->
id: value
, bad ->id: 'value'
- Access it in Python script using
self.ids.realll
orself.ids['realll']
- When your kv file is parsed, kivy collects all the widgets tagged with id’s and places them in this
self.ids
dictionary type property. That means you can also iterate over these widgets and access them dictionary style.
py file
- The
id
is a string - Cannot access it using
self.ids.var
- Not stored in
self.ids
Solution
gr_ly = GridLayout(id=str(i[1]))
#####adding a widget to the personalized id of layout
gr_ly.add_widget(self.DatosLayoutCI)
self.LayoutGeneralCI.ids.realll.add_widget(gr_ly)
#######all the code is in a function so i want to créate a layout that will #######contain the widgets with a personalized id and then calling the #######personalized id to add the widget in different and specific layouts##
####defining the layout and it's personalized id and adding to the class
gr_ly = GridLayout(id=str(i[1]))
#####adding a widget to the personalized id of layout
gr_ly.add_widget(self.DatosLayoutCI)
self.LayoutGeneralCI.ids.realll.add_widget(gr_ly)#####1 PRIMERA OPCION
Problem 2
Kept adding DatosLayoutCI widgets to the last widget, gr_ly
Solution
In order to display all the material (MATERIALES) under each section (SECCIONES), one has to use either one SQL statement with INNER JOIN or two SELECT statements (nested SELECTs).
Snippets - Nested SELECTs
def selection_data_secciones(self):
self.mainwid.dataBase = sqlite3.connect("UserData")
self.mainwid.dataCursor = self.mainwid.dataBase.cursor()
self.mainwid.dataCursor.execute("SELECT * FROM SECCIONES") # Sections
fetch = self.mainwid.dataCursor.fetchall()
for i in fetch:
self.LayoutGeneralCI = LayoutGeneralCI(self.mainwid)
ref_idd = i[1]
gr_ly = GridLayout(id=i[1], rows=1)
...
self.mainwid.dataCursor.execute("SELECT * FROM MATERIALES WHERE id=?", (gr_ly.id))
materials = self.mainwid.dataCursor.fetchall()
for produ in materials:
self.DatosLayoutCI = DatosLayoutCI(self.mainwid) # Datos = Data
...
gr_ly.add_widget(self.DatosLayoutCI)
self.mainwid.dataBase.commit() #DISCOMMENT NECCESARY
self.mainwid.dataBase.close()
Problem 1
self.LayoutGeneralCI.ids.var.add_widget(self.DatosLayoutCI)
File "kivyproperties.pyx", line 841, in kivy.properties.ObservableDict.__getattr__
AttributeError: 'super' object has no attribute '__getattr__'
Reason
The ids created in Python script is different from the ids created in the kv file.
Kivy Documentation
Kv Language » Referencing Widgets
Kv Language » Accessing Widgets defined inside Kv lang in your python code
Differences
kv file
- When assigning a value to id, remember that the value isn’t a string. There are no quotes: good ->
id: value
, bad ->id: 'value'
- Access it in Python script using
self.ids.realll
orself.ids['realll']
- When your kv file is parsed, kivy collects all the widgets tagged with id’s and places them in this
self.ids
dictionary type property. That means you can also iterate over these widgets and access them dictionary style.
py file
- The
id
is a string - Cannot access it using
self.ids.var
- Not stored in
self.ids
Solution
gr_ly = GridLayout(id=str(i[1]))
#####adding a widget to the personalized id of layout
gr_ly.add_widget(self.DatosLayoutCI)
self.LayoutGeneralCI.ids.realll.add_widget(gr_ly)
#######all the code is in a function so i want to créate a layout that will #######contain the widgets with a personalized id and then calling the #######personalized id to add the widget in different and specific layouts##
####defining the layout and it's personalized id and adding to the class
gr_ly = GridLayout(id=str(i[1]))
#####adding a widget to the personalized id of layout
gr_ly.add_widget(self.DatosLayoutCI)
self.LayoutGeneralCI.ids.realll.add_widget(gr_ly)#####1 PRIMERA OPCION
edited Mar 26 at 15:28
answered Mar 24 at 14:14
ikolimikolim
9,08511024
9,08511024
i tried that solution but the result is the same, the specific problem is that i want to add into the personalized layout widgets that have the same id as the layout, but trying this code when i run it always insert the layout on the final layout executed, another suggestion, please help
– Andrés Quiroz Valdovinos
Mar 24 at 17:18
If you are adding twogr_ly
then you have to executegr_ly.add_widget(self.DatosLayoutCI)
after instantiated eachgr_ly
.
– ikolim
Mar 24 at 21:43
i have added more code to a better understand of the problem, pelease check it and i hope you find an answer!, thanks
– Andrés Quiroz Valdovinos
Mar 25 at 4:14
please i need an answer
– Andrés Quiroz Valdovinos
Mar 26 at 0:50
Please refer to updated post.
– ikolim
Mar 26 at 15:29
|
show 2 more comments
i tried that solution but the result is the same, the specific problem is that i want to add into the personalized layout widgets that have the same id as the layout, but trying this code when i run it always insert the layout on the final layout executed, another suggestion, please help
– Andrés Quiroz Valdovinos
Mar 24 at 17:18
If you are adding twogr_ly
then you have to executegr_ly.add_widget(self.DatosLayoutCI)
after instantiated eachgr_ly
.
– ikolim
Mar 24 at 21:43
i have added more code to a better understand of the problem, pelease check it and i hope you find an answer!, thanks
– Andrés Quiroz Valdovinos
Mar 25 at 4:14
please i need an answer
– Andrés Quiroz Valdovinos
Mar 26 at 0:50
Please refer to updated post.
– ikolim
Mar 26 at 15:29
i tried that solution but the result is the same, the specific problem is that i want to add into the personalized layout widgets that have the same id as the layout, but trying this code when i run it always insert the layout on the final layout executed, another suggestion, please help
– Andrés Quiroz Valdovinos
Mar 24 at 17:18
i tried that solution but the result is the same, the specific problem is that i want to add into the personalized layout widgets that have the same id as the layout, but trying this code when i run it always insert the layout on the final layout executed, another suggestion, please help
– Andrés Quiroz Valdovinos
Mar 24 at 17:18
If you are adding two
gr_ly
then you have to execute gr_ly.add_widget(self.DatosLayoutCI)
after instantiated each gr_ly
.– ikolim
Mar 24 at 21:43
If you are adding two
gr_ly
then you have to execute gr_ly.add_widget(self.DatosLayoutCI)
after instantiated each gr_ly
.– ikolim
Mar 24 at 21:43
i have added more code to a better understand of the problem, pelease check it and i hope you find an answer!, thanks
– Andrés Quiroz Valdovinos
Mar 25 at 4:14
i have added more code to a better understand of the problem, pelease check it and i hope you find an answer!, thanks
– Andrés Quiroz Valdovinos
Mar 25 at 4:14
please i need an answer
– Andrés Quiroz Valdovinos
Mar 26 at 0:50
please i need an answer
– Andrés Quiroz Valdovinos
Mar 26 at 0:50
Please refer to updated post.
– ikolim
Mar 26 at 15:29
Please refer to updated post.
– ikolim
Mar 26 at 15:29
|
show 2 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55320893%2fattributeerror-super-object-has-no-attribute-getattr-when-trying-to-add%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You have to add more code in this question, the other question will be automatically eliminated in the future so for future readers will not understand your question, the idea is that your question will not only serve you but the community now and from the future
– eyllanesc
Mar 25 at 3:44