Я новичок в Python, и я пытался создать загрузку на YouTube.
Мне просто нужен графический интерфейс для легкого использования.
, поэтому я решил Kivy. Вход. Как будто его положение прикрепляется внизу.
или, как будто мое приложение использует только половину экрана.
Я искал межкетики, включая этот сайт, но, хотя есть много проблем с этикетками, моя конкретная проблема еще не здесь.
Я даже спросил генераторы A Установите или установите неправильно.
Может быть, это примерно так.import kivy
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.textinput import TextInput
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.uix.scrollview import ScrollView
class MyApp(App):
def build(self):
float_layout = FloatLayout()
# Make a BoxLayout to organiseren the widgets
box_layout = BoxLayout(orientation='vertical', size_hint=(1, None), pos_hint={'top': 0.78})
# Make a Label to display text
self.label = Label(text="YTDownloader", font_size=90, size_hint_y=None, height=100)
box_layout.add_widget(self.label)
self.label2 = Label(text="Youtube Downloader", size_hint_y=None, height=100)
box_layout.add_widget(self.label2)
#spacer label
self.label3 = Label(text="", size_hint_y=None, height=20)
box_layout.add_widget(self.label3)
# Make a TextInput-widget
self.text_input = TextInput(hint_text="Voer zoektermen in...", size_hint=(None, None), height=100, width=900, pos_hint={'center_x': 0.5}, padding=(20,20))
box_layout.add_widget(self.text_input)
#another spacer label
self.label4 = Label(text="", size_hint_y=None, height=30)
box_layout.add_widget(self.label4)
# Make a Button-widget
button = Button(text="Zoek!", size_hint=(None, None), height=100, width=300, pos_hint={'center_x': 0.5})
# connect a function to the button
button.bind(on_press=self.on_button_press)
box_layout.add_widget(button)
self.labelOutput = Label(text="", size_hint_y=None, width=960, text_size=(960, None), valign='top')
self.labelOutput.bind(texture_size=self.update_label_height)
box_layout.add_widget(self.labelOutput)
float_layout.add_widget(box_layout)
return float_layout
def on_button_press(self, instance):
# get the input text and display it in the output label
input_text = self.text_input.text
self.labelOutput.text = f"You entered: {input_text}"
def update_label_height(self, instance, value):
instance.height = instance.texture_size[1]
if __name__ == "__main__":
MyApp().run()
Подробнее здесь: https://stackoverflow.com/questions/795 ... ng-trouble
Киви этикетка Проблема ⇐ Python
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение