插入代码段(Python) 要如何输出变量?
回答
收藏

插入代码段(Python) 要如何输出变量?

X
X111111111111111
2024-04-23 09:26·浏览量:1510
X
X111111111111111
发布于 2024-04-23 09:25更新于 2024-04-23 09:261510浏览

如何 让python代码 输入或者输出变量供下一个指令使用?

我使用 插入代码段(Python)指令,要如何将变量输出来?

我看了说明文档,在最上一行代码去,设置一个 变量 =xx ;

但是这样以后,就执行不了了

代码如下

import tkinter as tk

def get_screen_resolution():
    root = tk.Tk()
    screen_width = root.winfo_screenwidth()
    screen_height = root.winfo_screenheight()
    root.destroy()  # Close the tkinter window after getting the resolution
    return screen_width, screen_height

# Get screen resolution
screen_width, screen_height = get_screen_resolution()

print("屏幕宽度:", screen_width)
print("屏幕高度:", screen_height)

# Define a variable for display
display = get_screen_resolution()
print(display)


有没有大佬能在此代码基础上帮忙改一下?



收藏
全部回答1
最新
发布回答
回答