I got stuck in trying to obtain the hierarchical view of a widget tree.
The code works fine and generates a nice tree like that:
ROOT(Animal):
|
|
|___Not extinct:
. | (red)
. |_____BIRD--------------(blue)
. | (green)
|
| (red)
|_____Mammal------------(blue)
| (green)
|
| (red)
|_____Reptile-----------(blue)
(green)
Here is the code with the tree hierarchy:
def myTreeWDG(self):
....
"""define tree"""
self.obj_animalTreeWDG = QtGui.QTreeWidget(self.obj_viewGroupBox)
self.obj_animalTreeWDG.setGeometry(QtCore.QRect(10, 20, 191, 131))
self.obj_animalTreeWDG.setObjectName("obj_animalTreeWDG")
"""ROOT: animal"""
obj_parent1 = QtGui.QTreeWidgetItem(self.obj_animalTreeWDG)
"""not extinct:"""
obj_childView1_1 = QtGui.QTreeWidgetItem()
obj_parent1.addChild(obj_childView1_1)
"""bird"""
obj_childView1_1_1 = QtGui.QTreeWidgetItem()
obj_childView1_1.addChild(obj_childView1_1_1)
"""3: red, blue, green"""
total=3
self.insert_treeLeaves(total,obj_childView1_1_1)
"""mamal"""
obj_childView1_1_2 = QtGui.QTreeWidgetItem()
obj_childView1_1.addChild(obj_childView1_1_2)
"""3: red, blue, green"""
total=3
self.insert_treeLeaves(total,obj_childView1_1_2)
"""reptile"""
obj_childView1_1_3 = QtGui.QTreeWidgetItem()
obj_childView1_1.addChild(obj_childView1_1_3)
"""3: red, blue, green"""
total=3
self.insert_treeLeaves(total,obj_childView1_1_3)
"""connect event"""
QtCore.QObject.connect(self.obj_animalTreeWDG, QtCore.SIGNAL('itemClicked(QTreeWidgetItem*, int)'), self.obj_treeViewInput)
Here is the code to add the leaves into the tree:
def insert_treeLeaves(self,total,tree_directParent):
for i in range(0,total):
"""leaves with color name"""
tree_child_leaf = QtGui.QTreeWidgetItem()
tree_directParent.addChild(tree_child_leaf)
Then, we have the function that tells us every time the tree is clicked, and where it was clicked:
def obj_treeViewInput(self,item,col):
print "obj _Qtree : pressed"
print "name:" item.text(col)
The problem is, how can we get if the touched leaf (red) belongs to the Bird or other father, i.e. how to get the following output give some mouse click:
Animal - Not extinct - Mammal - (red).
All comments and suggestions are highly appreciated.
What about a method in each QtreeWidgetItem in which you could print the path to this item.
In this method, you could use recursion to get the complete path of the item's parents (you have a "QTreeWidgetItem * parent () const" method to do this) and you add the current item's text to its parent's path ! You stop the recursion when an item do not have any parent.
I hope I understood your question and this helps you a little bit !
Do you have your own QTreeWidgetItem class ? You could use a specific role to achieve this...
Related
I'd like to use Python to read in a list of directories and store data in variables based on a template such as /home/user/Music/%artist%/[%year%] %album%.
An example would be:
artist, year, album = None, None, None
template = "/home/user/Music/%artist%/[%year%] %album%"
path = "/home/user/Music/3 Doors Down/[2002] Away From The Sun"
if text == "%artist%":
artist = key
if text == "%year%":
year = key
if text == "%album%":
album = key
print(artist)
# 3 Doors Down
print(year)
# 2002
print(album)
# Away From The Sun
I can do the reverse easily enough with str.replace("%artist%", artist) but how can extract the data?
If your folder structure template is reliable the following should work without the need for regular expressions.
path = "/home/user/Music/3 Doors Down/[2002] Away From The Sun"
path_parts = path.split("/") # divide up the path into array by slashes
print(path_parts)
artist = path_parts[4] # get element of array at index 4
year = path_parts[5][1:5] # get characters at index 1-5 for the element of array at index 5
album = path_parts[5][7:]
print(artist)
# 3 Doors Down
print(year)
# 2002
print(album)
# Away From The Sun
# to put the path back together again using an F-string (No need for str.replace)
reconstructed_path = f"/home/user/Music/{artist}/[{year}] {album}"
print(reconstructed_path)
output:
['', 'home', 'user', 'Music', '3 Doors Down', '[2002] Away From The Sun']
3 Doors Down
2002
Away From The Sun
/home/user/Music/3 Doors Down/[2002] Away From The Sun
The following works for me:
from difflib import SequenceMatcher
def extract(template, text):
seq = SequenceMatcher(None, template, text, True)
return [text[c:d] for tag, a, b, c, d in seq.get_opcodes() if tag == 'replace']
template = "home/user/Music/%/[%] %"
path = "home/user/Music/3 Doors Down/[2002] Away From The Sun"
artist, year, album = extract(template, path)
print(artist)
print(year)
print(album)
Output:
3 Doors Down
2002
Away From The Sun
Each template placeholder can be any single character as long as the character is not present in the value to be returned.
After concluding the first lecture of Harvard's AI course on edX, I have decided to implement the concepts taught, first being the depth-first search algorithm.
The objective of this program is to input a maze in text file mazefile and find a path from S to G using the depth-first search algorithm.
The project currently consists of 4 files, (1) the code with the class methods to operate or use the (2) text file which contains the maze, another text file (3) that contains the result file (where the AI has explored) and the main python script (4). Here they are, feel free to copy and paste these into a folder and to see how they run.
processText.py (file 1)
#code to process the mazefile file.
class importMaze:
def __init__(self,maze):
self.fileLines = []
self.fileName = maze
self.switch = False
self.toBeReturned = []
def processThis(self):
f = open(self.fileName,"r")
for x in f:
self.fileLines.append(x[:-1])
f.close()
for i in self.fileLines:
if self.switch == True:
if str(i) == "END":
self.switch = False
else:
self.toBeReturned.append(i)
else:
if str(i) == "START":
self.switch = True
return self.toBeReturned
class mazePointer:
def __init__(self,mazearray):
self.Sample = mazearray
self.initialPosition = []
for y in range(0, len(self.Sample)):
for x in range(0,len(self.Sample[y])):
if str(self.Sample[y][x]) == "S":
self.initialPosition = [x,y]
self.currentPosition = self.initialPosition
def whatIs(self,xcoordinate,ycoordinate):
return (self.Sample[ycoordinate])[xcoordinate]
def nearbyFreeSpaces(self,search):
self.freeSpaces = []
if self.whatIs(self.currentPosition[0]-1,self.currentPosition[1]) == search:
self.freeSpaces.append([self.currentPosition[0]-1,self.currentPosition[1]])
if self.whatIs(self.currentPosition[0]+1,self.currentPosition[1]) == search:
self.freeSpaces.append([self.currentPosition[0]+1,self.currentPosition[1]])
if self.whatIs(self.currentPosition[0],self.currentPosition[1]-1) == search:
self.freeSpaces.append([self.currentPosition[0],self.currentPosition[1]-1])
if self.whatIs(self.currentPosition[1],self.currentPosition[1]+1) == search:
self.freeSpaces.append([self.currentPosition[1],self.currentPosition[1]+1])
return self.freeSpaces
def moveTo(self,position):
self.currentPosition = position
TestingTrack.py (the main file)
from processText import importMaze, mazePointer
testObject = importMaze("mazefile")
environment = testObject.processThis()
finger = mazePointer(environment)
frontier = []
explored = []
result = ""
def Search():
global result
if len(finger.nearbyFreeSpaces("G")) == 1: #If the goal is bordering this space
result = finger.nearbyFreeSpaces("G")[0]
explored.append(finger.currentPosition)
else:
newPlaces = finger.nearbyFreeSpaces("F") #finds the free spaces bordering
for i in newPlaces:
if i in explored: #Skips the ones already visited
pass
else:
frontier.append(i)
while result == "":
explored.append(finger.currentPosition)
Search()
finger.moveTo(frontier[-1])
frontier.pop(-1)
exploredArray = []
for y in range(len(environment)): #Recreates the maze, fills in 'E' in where the AI has visited.
holder = ""
for x in range(len(environment[y])):
if [x,y] in explored:
holder+= "E"
else:
holder+= str(environment[y][x])
exploredArray.append(holder)
def createResult(mazeList,title,append): #Creating the file
file = open("resultfile",append)
string = title + " \n F - Free \n O - Occupied \n S - Starting point \n G - Goal \n E - Explored/Visited \n (Abdulaziz Albastaki 2020) \n \n (top left coordinate - 0,0) \n "
for i in exploredArray:
string+= "\n" + str(i)
string+= "\n \n Original problem \n"
for i in environment:
string+= "\n" +str(i)
file.write(string)
file.close()
def tracingPath():
initialExplored = explored
proceed = True
newExplored = []
for i in explored:
finger.moveTo() #incomplete
print(explored)
createResult(exploredArray,"DEPTH FIRST SEARCH", "w")
mazefile (the program will read this file to get the maze)
F - Free
O - Occupied
S - Starting point
G - Goal
(Abdulaziz Albastaki 2020)
START
OOOOOOOOOOOOOOOO
OFFFFFFFFFFFFFGO
OFOOOOOOOOOOOOFO
OFOOOOOOOOOOOOFO
OFOOOOOOOOOOOOFO
OFOOOOOOOOOOOOFO
OSFFFFFFFFFFFFFO
OOOOOOOOOOOOOOOO
END
Made by Abdulaziz Albastaki in October 2020
You can change the maze and its size however it must
-Respect the key above
-Have ONE Starting point and goal
-The maze must be in between 'START' and 'END'
-The maze MUST be surrounded by occupied space
SAMPLE PROBLEMS:
OOOOOOOOOOOOOOOO
OFFFFFFFFFFFFFGO
OFOOOOOOOOOOOOFO
OFOOOOOOOOOOOOFO
OFOOOOOOOOOOOOFO
OFOOOOOOOOOOOOFO
OSFFFFFFFFFFFFFO
OOOOOOOOOOOOOOOO
OOOOOOOOOOOOOOOOO
OFOFFFFFOOOFFFOOO
OFFFOOOFOOFFOOOFO
OFOOOOOFOOFOOOOFO
OSFGFFFFFFFFFFFFO
OOOOOOOOOOOOOOOOO
There is also a resultfile, however if you would just create an empty textfile with that name (no extension), the program will fill it in with results.
The problem is with the resultfile, here it is:
DEPTH FIRST SEARCH
F - Free
O - Occupied
S - Starting point
G - Goal
E - Explored/Visited
(Abdulaziz Albastaki 2020)
(top left coordinate - 0,0)
OOOOOOOOOOOOOOOO
OFFFFFFFFFFFFFGO
OFOOOOOOOOOOOOEO
OFOOOOOOOOOOOOEO
OFOOOOOOOOOOOOEO
OEOOOOOOOOOOOOEO
OEFFFEEEEEEEEEEO
OOOOOOOOOOOOOOOO
Original problem
OOOOOOOOOOOOOOOO
OFFFFFFFFFFFFFGO
OFOOOOOOOOOOOOFO
OFOOOOOOOOOOOOFO
OFOOOOOOOOOOOOFO
OFOOOOOOOOOOOOFO
OSFFFFFFFFFFFFFO
OOOOOOOOOOOOOOOO
The AI skipped a few spaces to get to the goal, why is it doing so?
Feel free to ask me for any clarifications.
There are the following issues:
the last if block in nearbyFreeSpaces uses a wrong index:
if self.whatIs(self.currentPosition[1],self.currentPosition[1]+1) == search:
self.freeSpaces.append([self.currentPosition[1],self.currentPosition[1]+1])
should be:
if self.whatIs(self.currentPosition[0],self.currentPosition[1]+1) == search:
self.freeSpaces.append([self.currentPosition[0],self.currentPosition[1]+1])
The final position is not correctly added to the path. The last line of this block:
if len(finger.nearbyFreeSpaces("G")) == 1: #If the goal is bordering this space
result = finger.nearbyFreeSpaces("G")[0]
explored.append(finger.currentPosition)
...should be:
explored.append(result)
I have the following codes for my radio buttons and this is for my full menu programming project with tkinter:
from tkinter import *
from time import sleep
class SchoolCampMenuGUI:
def __init__(self,parent):
#------------------------------Layout Of Menu------------------------------------------#
Top=Frame(parent,bg="white")
Top.pack(side=TOP) #frame for title School Camp Menu
lblTitle=Label(Top,font=('New York Times',15),text="\t\tSchool Camp Menu\t\t\n(Please choose 1 breakfast,lunch and dinner and below 8700KJ) ")
lblTitle.pack() #setting fonts and size
f4=Label(borderwidth=3,relief=SUNKEN)
f4.pack(side=BOTTOM,fill=X)
f1=Label(borderwidth=3,relief=SUNKEN,bg="white")
f1.pack(side=LEFT) #first label for Breakfast
f2=Label(borderwidth=3,relief=SUNKEN,bg="white")
f2.pack(side=RIGHT) #second label for Lunch
f3=Label(borderwidth=3,relief=SUNKEN,bg="white")
f3.pack() #third label for dinner
def onclick1():
r.set(None)
q.set(None)
v.set(None)
def clear():
sleep(0.5)
f4.configure(text="")#define the definition of RESET button all value set to None to reselect choices and clears all calculations.
b1=Button(f4,text="RESET",width=8,bg="red",command=lambda:[onclick1(),clear()])#calling the combined function
b1.pack(side=RIGHT)
def total():
total=int(v.get())+int(r.get())+int(q.get())
f4.configure(text="Your Current Total Is: "+total+" KJs.")
r=StringVar()
v=StringVar()
q=StringVar()
r.set(0)
v.set(0)
q.set(0)
#--------------------------------------Lunch--------------------------------------#
lblMeal=Label(f3,text="Lunch",font=('arial',14,'bold'),bg="white")
lblMeal.pack()
rb1=Radiobutton(f3,text="Chicken Burgers",variable=r,font=('arial',12,'bold'),value=1180,bg="white",command=total)
rb1.pack(anchor=W)
rb2=Radiobutton(f3,text="Chicken Curry and Rice",variable=r,font=('arial',12,'bold'),value=1800,bg="white",command=total)
rb2.pack(anchor=W)
rb3=Radiobutton(f3,text="Teriyaki Chicken Sushi *Gluten Free",variable=r,font=('arial',12,'bold'),value=1730,fg="violet",command=total)
rb3.pack(anchor=W)
rb4=Radiobutton(f3,text="Caprese Panini *Gluten Free",variable=r,font=('arial',12,'bold'),value=2449,fg="violet",command=total)
rb4.pack(anchor=W)
rb5=Radiobutton(f3,text="Vegetable Risotto *Vegetarian",variable=r,font=('arial',12,'bold'),value=1432,fg="blue",command=total)
rb5.pack(anchor=W)
rb6=Radiobutton(f3,text="Gourmet Vegetable Pizza *Vegetarian",variable=r,font=('arial',12,'bold'),value=1463,fg="blue",command=total)
rb6.pack(anchor=W)
#----------------------------------Breakfast----------------------------------#
Meal=Label(f1,text="Breakfast",font=('arial',14,'bold'),bg="white")
Meal.pack()
rb7=Radiobutton(f1,text="Bacon and Egg Muffin",variable=v,font=('arial',12,'bold'),value=1240,bg="white",command=total)
rb7.pack(anchor=W)
rb8=Radiobutton(f1,text="Scrambled Eggs & Bake Beans",variable=v,font=('arial',12,'bold'),value=1533,bg="white",command=total)
rb8.pack(anchor=W)
rb9=Radiobutton(f1,text="2 Weet-Bix w/ milk",variable=v,font=('arial',12,'bold'),value=1110,bg="white",command=total)
rb9.pack(anchor=W)
rb10=Radiobutton(f1,text="Pancakes w/ syrup",variable=v,font=('arial',12,'bold'),value=2019,bg="white",command=total)
rb10.pack(anchor=W)
rb11=Radiobutton(f1,text="Bread with jam",variable=v,font=('arial',12,'bold'),value=491,bg="white",command=total)
rb11.pack(anchor=W)
rb12=Radiobutton(f1,text="Cinnamon Roll Doughnuts",variable=v,font=('arial',12,'bold'),value=1130,bg="white",command=total)
rb12.pack(anchor=W)
#----------------------------------dinner-----------------------------------#
Dinner=Label(f2,text="Dinner",font=('arial',14,'bold'),bg="white")
Dinner.pack()
rb13=Radiobutton(f2,text="Spaghetti Bolongnese",variable=q,font=('arial',12,'bold'),value=1523,bg="white",command=total)
rb13.pack(anchor=W)
rb14=Radiobutton(f2,text="Beef Burgers w/ Chips and Salad",variable=q,font=('arial',12,'bold'),value=3620,bg="white",command=total)
rb14.pack(anchor=W)
rb15=Radiobutton(f2,text="Meatball and Butter Bean Stew *Gluten Free",variable=q,font=('arial',12,'bold'),value=1820,fg="violet",command=total)
rb15.pack(anchor=W)
rb16=Radiobutton(f2,text="Roast Beef *Gluten Free",variable=q,font=('arial',12,'bold'),value=2280,fg="violet",command=total)
rb16.pack(anchor=W)
rb17=Radiobutton(f2,text="Creamy Broccoli Gnocchi *Vegetarian",variable=q,font=('arial',12,'bold'),value=2800,fg="blue",command=total)
rb17.pack(anchor=W)
rb18=Radiobutton(f2,text="Vegetable Wellington *Vegetarian",variable=q,font=('arial',12,'bold'),value=2270,fg="blue",command=total)
rb18.pack(anchor=W)
Is there a way to add all values together but not getting them? This is for my school menu project. Any help appreciated.
Note: The values are in KJs for food. So far I have all the values but they are just put there, e.g. 11801800, but not adding it up. I used r.get()+v.get() but they don't actually add the values up.
They do add up. Your problem is that r.get() returns a string, not an integer. First convert them, then sum up.
int(r.get()) + int(v.get())
I want to create a conversational alexa skill using Flask-Ask and python 3. But when I intentionally omit the required slot. Alexa doesn't prompt me anything. It goes to FallBackIntent directly. I've set the prompt and corresponding answer for it in the web console and I've added necessary code to check if dialogState!= 'COMPLETED' and return delegate(). But it just go to FallBackIntent directly.
Below is a screenshot of my settings for the slot on the web console
Below is my entire code(I use ngrok to map to my localhost):
from flask import Flask
from flask_ask import Ask, statement, question, session, convert_errors, delegate
import random
import logging
app = Flask(__name__)
ask = Ask(app, "/ask_demo")
app.logger.setLevel(logging.DEBUG)
logger = app.logger
facts = ['A year on Mercury is just 88 days long.',
'Despite being farther from the Sun, Venus experiences higher temperatures than Mercury.',
'Venus rotates counter-clockwise, possibly because of a collision in the past with an asteroid.',
'On Mars, the Sun appears about half the size as it does on Earth.',
'Earth is the only planet not named after a god.',
'Jupiter has the shortest day of all the planets.',
'The Milky Way galaxy will collide with the Andromeda Galaxy in about 5 billion years.',
'The Sun contains 99.86% of the mass in the Solar System.',
'The Sun is an almost perfect sphere.',
'A total solar eclipse can happen once every 1 to 2 years. This makes them a rare event.',
'Saturn radiates two and a half times more energy into space than it receives from the sun.',
'The temperature inside the Sun can reach 15 million degrees Celsius.',
'The Moon is moving approximately 3.8 cm away from our planet every year.',]
fact_index_by_planets =dict()
fact_index_by_planets['mercury'] = [0]
fact_index_by_planets['venus'] = [1,2]
fact_index_by_planets['mars'] = [3]
fact_index_by_planets['earth'] = [4]
fact_index_by_planets['jupiter'] = [5]
fact_index_by_planets['sun'] = [7,8,9,11]
fact_index_by_planets['saturn'] = [10]
fact_index_by_planets['moon'] = [12]
sample_questions = 'What planet do you ask for, you can say a fact about Mercury, Venus, Mars, Earth, Jupiter, Sun, ' \
'Saturn or Moon?'
def get_dialog_state():
return session['dialogState']
def get_fact(planet):
planet = planet.lower()
indices = fact_index_by_planets[planet]
index = random.choice(indices)
return facts[index]
# #app.route('/',methods=['GET'])
# def homepage():
# return "hi this is the homepage!"
#ask.launch
def start_skill():
welcome_message = 'Hello there, Welcome! {}'.format(sample_questions)
logger.debug('Launch')
return question(welcome_message)
#ask.intent("FactIntent")
def tell_fact(planet):
dialog_state = get_dialog_state()
if dialog_state != 'COMPLETED':
return delegate()
logger.debug("The planet asked for is: {}".format(planet))
if convert_errors and 'planet' in convert_errors:
return question("Can you please repeat the planet name, you can say Mercury, Venus, Mars, Earth, Jupiter, Sun, Saturn or Moon?")
fact_msg = get_fact(planet)
return question(fact_msg+"Anything else?")
#ask.intent("AMAZON.StopIntent")
def stop(str):
logger.debug('Stop')
return statement('Thank you for using me! See you')
#ask.intent('AMAZON.FallbackIntent')
def fall_back():
logger.debug('Not Understood')
return question("Sorry! I don't understand Could you repeat that?")
if __name__ == '__main__':
app.run(debug=True, port=3000)
Could anyone tell me what is wrong with my code?
Thank you!
I have this class that give me back a table with header and values under:
class table (Frame):
def __init__(self, parent,controller,pagina,search=None):
Frame.__init__(self, parent)
self.controller = controller
self.pagina=pagina
self.search=search
self.CreateUI()
self.LoadTable()
self.grid(sticky = (N,S,W,E))
def fix_result (query_result): #used to fix the query result in a good format for the table
header=[]
lines=[]
i=0
while i<len(query_result):
header.append(query_result[i][0])
lines.append(query_result[i][1:len(query_result[i])])
i+=1
return (header,lines)
def CreateUI(self):
tv = Treeview(self)
if self.pagina=='home': #declare the info needed for the home page
tv.heading("#0", text='ID')
tv.column("#0", anchor='center',width =(len('ID')+40))
tv['columns'] = ('Data Scadenza','Ultimo Pagamento','Nome','Cognome' ,'Telefono' ,'Cellulare' ,'Email')
elif self.pagina=='user_info': # declare the info needed for the user page
tv.heading("#0", text='ID')
tv.column("#0", anchor='center',width =(len('ID')+40))
tv['columns'] = ('Nome' ,'Cognome' ,'Nascita' ,'Codicefiscale' ,'Indirizzo' ,'Citta' ,'Provincia' ,'Telefono' ,'Cellulare' ,'Email')
i=0
while i<len (tv['columns']):
tv.heading(tv['columns'][i],text=tv['columns'][i])
################ establish the width of the column based
if tv['columns'][i]=='Data Nascita' or tv['columns'][i]=='Telefono' or tv['columns'][i]=='Cellulare' or tv['columns'][i]=='Costo Iscr.' or tv['columns'][i]=='Data Corso' or tv['columns'][i]=='Prezzo Corso':
tv.column(tv['columns'][i], anchor='center',width =(len(tv['columns'][i])+70))
else:
tv.column(tv['columns'][i], anchor='center',width =(len(tv['columns'][i])+160))
i+=1
tv.grid(sticky = (N,S,W,E))
self.treeview = tv
def LoadTable(self):
db=DB()
if self.pagina=='home': #####create data for the table in case that we are in the home page
month_ago= date.today() + relativedelta(months=-1)
month=str(month_ago)
self.db=DB()
a=self.db.db_query("select m.id, m.dataiscrizione, m.datapagamento, u.nome, u.cognome, u.telefono, u.cellulare, u.email from membership m join users u on m.id=u.id where m.stato='0' and m.dataiscrizione<'"+month.replace("-", "/")+"' order by m.id")
self.result=table.fix_result (a)
#a use to be a=[(Value0.1, Value0.2),(Value1.1, Value1.2),...]
#self.result use to be self.result=[(Value0.1,Value1.1,Value2.1),[(Value1.2, Value1.3),(Value2.2, Value2.3),(Value3.2, Value3.3)]]
elif self.pagina=='user_info' and self.search!=None: #####create data for the table in case that we are in the user page
a=db.db_query("select * from users where id='"+str(self.search)+"'")
self.result=table.fix_result (a)
i=0
while i<len(self.result[0]): #introduce values in the table
self.treeview.insert('', 'end', text=str(self.result[0][i]), values=(self.result[1][i]))
i+=1
I'd like to re-use this functionality when the self.pagina=='user_info'; in this moment is working but create a table of this form:
Header1 | Header2 | Header3 |.....
---------------------------- .....
Value0.1| Value0.2| Value0.3|.....
Value1.1| Value1.2| Value1.3|.....
What I want is that in case that self.pagina=='home', the table still in this way, but in case that self.pagina=='user_info' I know that we have just 1 set of Value so I'd like to have:
Header1| Value0.1
Header2| Value0.2
Header3| Value0.3
Header4| Value0.4
................
In both case I have a result like this one, but in the second one I have every time just one row and for this reason I wanted a vertical table!
I try different things with this code but I couldn't re-use the same functionality but I had to write a new one.... Is there some way just to invert the table?