...
bot = Bot(token=...)
...
async def get_chat_history(user_id: int):
updates = await bot.get_updates()
chat_messages = [update.message for update in updates if update.message and update.message.chat.id == user_id]
return len(chat_messages), chat_messages[-1].message_id if chat_messages else None
with open("area.txt", "r") as area:
for i in area:
print(i.rstrip())
if i.rstrip() in act_mes:
print(act_mes)
pack()
нет параметров x
и y
, поэтому вместо pack
вы можете использовать place()
. В данном случае btnSc.place(x=50, y=50)
FuncButton
если его методы не используют экземпляр класса? В этом нет никакого смысла. Но если уж очень хочется, то я рекомендовал бы использовать декоратор @staticmethod
from tkinter import *
import webbrowser
class FuncButton:
@staticmethod
def btn1():
pass
@staticmethod
def btn2():
pass
@staticmethod
def btn3():
pass
@staticmethod
def website():
site_root = Tk()
site_root.geometry('600x500')
site_root.title('New window')
site_root.resizable(width=False, height=False)
btnSc = Button(site_root, text='Проба', bg='blue', font=('Arial', 16, 'bold'),
command=lambda: webbrowser.get(using=None).open_new_tab('https://www.youtube.com'))
btnSc.place(x=50, y=50) # Используем place вместо pack
site_root.mainloop()
main_root = Tk()
main_root.geometry('600x500')
main_root.title('Main window!')
main_root.resizable(width=False, height=False)
main_root.image = PhotoImage(file='BG.png')
bg_logo = Label(main_root, image=main_root.image)
bg_logo.grid(row=0, column=0)
btnOne = Button(main_root, text='ONE', bg='yellow', font=('Arial', 16, 'bold'),
command=lambda: FuncButton.btn1())
btnOne.place(x=88, y=155, width=195, height=40)
btnTwo = Button(main_root, text='TWO', bg='red', font=('Arial', 16, 'bold'),
command=lambda: FuncButton.btn2())
btnTwo.place(x=88, y=200, width=195, height=40)
btnThree = Button(main_root, text='THREE', bg='pink', font=('Arial', 16, 'bold'),
command=lambda: FuncButton.btn3())
btnThree.place(x=88, y=245, width=195, height=40)
btnS = Button(main_root, text='WEBSITE', bg='lightgreen', font=('Arial', 16, 'bold'),
command=lambda: FuncButton.website())
btnS.place(x=88, y=290, width=195, height=40)
main_root.mainloop()
и не говорить мне учитьсяИменно это я и скажу. Мы должны все разжевать и вам в рот положить?
но я совсем недавно началЭто не даёт вам права не учиться
прошу найти именно ошибкуВот именно поэтому, я и посылаю вас учиться.
я уже задавал этот вопросА это чревато его удалением или даже баном.
Учиться, учиться и ещё раз учиться. А не ботов писать.
def analyze_sales(input_strings):
limit = int(input_strings[-1]) # Последняя строка - это порог
products = input_strings[:-1] # Всё остальное - товары
# Здесь должно быть всё понятно
results = []
for product in products:
parts = product.split(',')
name = parts[0]
prices = list(map(int, parts[1:]))
average_price = sum(prices) / len(prices)
if average_price > limit:
results.append(f'{name},{average_price:.1f}')
return results
lines = []
while True:
try:
line = input()
if line == "":
break
except EOFError:
break
lines.append(line)
for product in analyze_sales(lines):
print(product)
я не программистНу или как вариант - фриланс