Answer the question
In order to leave comments, you need to log in
Error in python, (tkinter library) can you help?
In general, I want to create a program to find out the weather, but when I click to find out, an error is displayed
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python3.6/tkinter/__init__.py", line 1705, in __call__
return self.func(*args)
File "pogodaGUI.py", line 59, in <lambda>
return lambda : callback(id, tex)
File "pogodaGUI.py", line 62, in callback
s = 'Утром: ' + pogoda1 + ' ' + pogoda2 + ' Днём: ' + pogoda3 + ' ' + pogoda4
NameError: name 'pogoda1' is not defined
from tkinter import *
from tkinter.ttk import *
import requests, bs4
import sys
top = Tk()
#root = Tk()
###
#text = Text(width=25, height=5, bg="darkgreen", fg='white', wrap=WORD)
#text.pack()
#text = print ('Ага')
#text.pack ()
#root.mainloop()
# s = requests.get('https://sinoptik.com.ru/погода-)
# b = bs4.BeautifulSoup(s.text, "html.parser")
# p3=b.select('.temperature .p3')
# pogoda1=p3[0].getText()
# p4=b.select('.temperature .p4')
# pogoda2=p4[0].getText()
# p5=b.select('.temperature .p5')
# pogoda3=p5[0].getText()
# p6=b.select('.temperature .p6')
# pogoda4=p6[0].getText()
v = StringVar()
e = Entry(top, textvariable=v)
e.pack()
def get_value():
print(v.get())
def clean_value():
v.set("")
b1 = Button(top, text="Ваш город", width=10, command=get_value)
b2 = Button(top, text="очистить", width=10, command=clean_value)
b1.pack()
b2.pack()
def pogoda():
global pogoda1
global pogoda2
global pogoda3
global pogoda4
s = requests.get('https://sinoptik.com.ru/погода-' + v)
b = bs4.BeautifulSoup(s.text, "html.parser")
p3=b.select('.temperature .p3')
pogoda1=p3[0].getText()
p4=b.select('.temperature .p4')
pogoda2=p4[0].getText()
p5=b.select('.temperature .p5')
pogoda3=p5[0].getText()
p6=b.select('.temperature .p6')
pogoda4=p6[0].getText()
def cbc(id, tex):
return lambda : callback(id, tex)
def callback(id, tex):
s = 'Утром: ' + pogoda1 + ' ' + pogoda2 + ' Днём: ' + pogoda3 + ' ' + pogoda4
tex.insert(END, s)
tex.see(END) # Scroll if necessary
# top = Tk()
tex = Text(master=top)
tex.pack(side=RIGHT)
bop = Frame()
bop.pack(side=LEFT)
for k in range(1):
tv = 'узнать {}'.format(k)
b = Button(bop, text=tv, command=cbc(k, tex))
b.pack()
Button(bop, text='Свалить', command=top.destroy).pack()
###
# v = StringVar()
# e = Entry(top, textvariable=v)
# e.pack()
# def get_value():
# print(v.get())
# def clean_value():
# v.set("")
# b1 = Button(top, text="Ваш город", width=10, command=get_value)
# b2 = Button(top, text="очистить", width=10, command=clean_value)
# b1.pack()
# b2.pack()
###
top.mainloop()
Answer the question
In order to leave comments, you need to log in
Modx+Minishop+Editor role
In the admin panel there will be only a project tree and a media manager
You can use any free CMS (even Joomla), you can attach Virtumart to it and disable the purchase function in it
1) Popular CMS are right for you. I once did simple projects on host cms free version.
2) there are options with platforms like insales. But it is relatively expensive.
3) to write yourself, you need to have an understanding of how the store will work, where it will grow, and so on. + to know at the proper level languages.
ANGULAR.JS in the tags is clearly superfluous. You can't deploy a light site on it.
I wrote for a similar solution myself. Took Slim and Bootstrap + jQuery. Maybe now they will throw rags, but it works smartly and adaptively.
I made the admin panel on the knee, but that's why it is the admin panel, that a person in it will not break anything on purpose.
I scratch my head from time to time, maybe all this should have been done on WordPress because it would be faster in development. But WP is not familiar and I do not know stones.
Take a look at LightCMS.
If you still take AngularJs, then a bunch of Angular + Mongo + Node.js will come out with the admin panel
def pogoda():
global pogoda1
print(pogoda1)
. "NameError: name 'pogoda1' is not defined"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question