小编acw*_*668的帖子

Tkinter 如何根据此组合框自动更新第二个组合框

我在 Tkinter Python 中遇到了组合框更新的问题。

我有两个组合框:

  • A带有values =['A','B','C']和 的组合框
  • 组合框B

我想要的是:

  • A当在组合框中选择值时A,然后在组合框中B显示值['1','2','3']

  • B当在组合框中选择值时A,然后在组合框中B显示值['11','12','13']

  • C当在组合框中选择值时A,然后在组合框中B显示值 s['111','112','113']

目前我的部分代码如下:

def CallHotel(*args):
    global ListB
    if hotel.get()==ListA[0]
        ListB=ListB1
    if hotel.get()==ListA[1]
        ListB=ListB2
    if hotel.get()==ListA[2]
        ListB=ListB3

ListA=['A','B','C']

ListB1=['1','2','3']

ListB2=['11','12','13']

ListB3=['111','112','113']

ListB=ListB1

hotel = StringVar()
hotel.set('SBT')

comboboxA=ttk.Combobox(win0,textvariable=hotel,values=ListA,width=8)
comboboxA.bind("<<ComboboxSelected>>",CallHotel)
comboboxA.pack(side='left')  

stp = StringVar()
stp.set('STP')

comboboxB=ttk.Combobox(win0,textvariable=stp,values=ListB,width=15)
comboboxB.pack(side='left')
Run Code Online (Sandbox Code Playgroud)

python combobox tkinter

5
推荐指数
1
解决办法
7834
查看次数

JQuery with Eel:无法加载资源:net::ERR_FILE_NOT_FOUND

我正在学习Python和JS。我尝试编写一个显示天气的应用程序。但我收到了这个错误:

Failed to load resource: net::ERR_FILE_NOT_FOUND
main.html:27 Uncaught (in promise) ReferenceError: eel is not defined
    at display_weather (main.html:27)
    at HTMLButtonElement.<anonymous> (main.html:32)
    at HTMLButtonElement.dispatch (jquery.min.js:2)
    at HTMLButtonElement.v.handle (jquery.min.js:2)
Run Code Online (Sandbox Code Playgroud)

我已经尝试了很多东西来解决这个问题,但我不能。eel 有问题,我已经安装了教程中显示的 eel。这是带有 html 和 js 的文件

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Weather by Alibek</title>


    <script type="text/javascript" src="/eel.js"></script>
    <link rel="stylesheet" type="image/png" href="weather-icon.png">
    <link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>

    <input id="location" type="text" placeholder="Write the name of your Country ot City" required="" value="Bukhara, Uzbekistan">

    <button id ="show">Know the weather</button>

    <div id="info ">
        
    </div>
    <script …
Run Code Online (Sandbox Code Playgroud)

html javascript python jquery

5
推荐指数
0
解决办法
210
查看次数

标签 统计

python ×2

combobox ×1

html ×1

javascript ×1

jquery ×1

tkinter ×1