QLineEdit
есть метод text
. А так - просто создаете кнопку, привязываете к ней функцию, и в этой функции уже можно вызать метод textimport sys
from PyQt4.QtGui import QDialog, QApplication, QPushButton, QLineEdit, QFormLayout
class Form(QDialog):
def __init__(self, parent=None):
super(Form, self).__init__(parent)
self.le = QLineEdit()
self.le.setObjectName("text")
self.le.setText("Text")
self.pb = QPushButton()
self.pb.setObjectName("button")
self.pb.setText("Button")
layout = QFormLayout()
layout.addWidget(self.le)
layout.addWidget(self.pb)
self.setLayout(layout)
self.pb.clicked.connect(self.button_click)
self.setWindowTitle("example")
def button_click(self):
text = self.le.text()
print(text)
app = QApplication(sys.argv)
form = Form()
form.show()
app.exec_()
if count != 20:
await message.answer(text)
text = ""
for i in response:
text += f"{i['id']} | {i['name']} | {i['type']} \n"
count += 1
if count == 20:
await message.answer(text)
count = 0
time.sleep(5)
if count != 20:
await message.answer(text)
text = ""
if count != 0:
await message.answer(text)
login_btns = driver.find_elements_by_xpath('//button[text()="Login"]')
for login_btn in login_btns:
driver.execute_script("arguments[0].disabled=false", login_btn)
async def desc_task(ctx, channel: discord.TextChannel, *, arg):
import telebot
from telebot import types
import re
items = ['A el', 'B el', 'C el', 'D el']
def generate_markup(pages_count, current_page=0):
markup = types.InlineKeyboardMarkup()
for i in range(pages_count):
markup.add(types.InlineKeyboardButton(i+1, callback_data='page_{}'.format(i)))
btn_back = types.InlineKeyboardButton('Назад', callback_data='page_{}'.format(current_page-1))
btn_forward = types.InlineKeyboardButton('Вперед', callback_data='page_{}'.format(current_page+1))
if current_page == pages_count-1:
markup.add(btn_back)
elif current_page == 0:
markup.add(btn_forward)
else:
markup.row(btn_back, btn_forward)
return markup
@bot.message_handler(commands=['start'])
def send_start(message):
bot.send_message(message.chat.id, items[0], reply_markup=generate_markup(len(items)))
@bot.callback_query_handler(func = lambda call: re.match(r'page_\d+$', call.data))
def callback_query(call):
page = int(re.match(r'page_(\d+)$', call.data).group(1))
bot.edit_message_text(items[page], call.message.chat.id, call.message.message_id, reply_markup=generate_markup(len(items), page))
sent_message = bot.send_message(message.chat.id,"Привет")
bot.edit_message_text('указанный текст', chat_id=message.chat.id, message_id=sent_message.message_id)
хочу вытащить эти данные из базы данных запросом на сервер
# urls.py
urlpatterns = [
path('get-records/', views.get_records, name='get-records'),
]
# views.py
from mainapp.models import Visited
# вьюха, которая обрабатывает ваш запрос
def get_records(request):
all_entries = Visited.objects.all()
# ну и дальше уже что там нужно с ними
from kivy.config import Config
Config.set("graphics", "resizable", 0)
Config.set("graphics", "width", 700)
Config.set("graphics", "height", 600)
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.widget import Widget
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.textinput import TextInput
from kivy.uix.gridlayout import GridLayout
In order to avoid situations where the config settings do not work or are not applied before window creation (like setting an initial window size), Config.set should be used before importing any other Kivy modules. Ideally, this means setting them right at the start of your main.py script.
p=subprocess.Popen(['youtube-dl', "--list-formats", "https://www.youtube.com/watch?v=e_Z6ZcCwPcU"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
It is also special in that the server could have sent the same header multiple times with different values, but requests combines them so they can be represented in the dictionary within a single mapping, as per RFC 7230:
A recipient MAY combine multiple header fields with the same field name into one “field-name: field-value” pair, without changing the semantics of the message, by appending each subsequent field value to the combined field value in order, separated by a comma.