我目前正在使用猕猴桃和硒制作智能电视界面。我试图使其在按界面上的按钮时的位置加载浏览器,然后最小化mainapp屏幕。尽管隐藏和最小化功能对我都不起作用。再说一次,我在理解它们的工作方式时遇到问题,请帮忙。此外,任何提示都将不胜感激。
from kivy.config import Config
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.floatlayout import FloatLayout
from selenium import webdriver
Config.set('graphics', 'resizable', 'False')
Config.set('graphics', 'borderless', 'True')
Config.set('graphics', 'fullscreen', 'auto')
x = .25
y = .25
xpos = 1366/4
ypos = 768/3
#def returnapp():
# while
def netflix_log(x):
import kivy.core.window
from kivy.core import window
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--disable-infobars")
driver = webdriver.Chrome(chrome_options=chrome_options)
driver.fullscreen_window()
driver.get("https://www.beta.netflix.com/login")
driver.find_element_by_name("userLoginId").send_keys("1234")
driver.find_element_by_name("password").send_keys("1234")
submit = driver.find_element_by_css_selector(".btn.login-button.btn-submit.btn-small")
submit.click()
hide(mainapp).run()
return
netflix = Button(background_normal=('netflix.png'),
size_hint=(x, y),
pos=(0 + 10, ypos + 10),
on_press=netflix_log)
hulu = Button(background_normal=('hulu.png'),
size_hint=(x, y),
pos=(xpos, ypos))
youtube = Button(background_normal=('youtube.png'),
size_hint=(x, y),
pos=(xpos * 2, ypos))
fox = Button(background_normal=('fox.png'),
size_hint=(x, y),
pos=(xpos * 3, ypos))
amazon_prime = Button(background_normal=('amazon prime.png'),
size_hint=(x, y),
pos=(0, 0))
youtube_tv = Button(background_normal=('Youtubetv.png'),
size_hint=(x, y),
pos=(xpos, 0))
settings = Button(background_normal=("settings.png"),
size_hint=(x, y),
pos=(xpos * 2, 0))
applications = [netflix, hulu, youtube, fox, amazon_prime, youtube_tv, settings]
class mainapp(App):
def build(self):
print("e2")
lay = FloatLayout()
for i in applications:
lay.add_widget(i)
return lay
def settings_click():
for items in applications:
FloatLayout().remove_widget(items)
for items in settings_menu:
FloatLayout().add_widget(items)
return FloatLayout()
mainapp().run()