| 
 | 
 
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册  
 
x
 
1python如何在指定位置输出文本(命令行)? 
- def toxy(x, y):
 
 -     # 一些代码
 
 -     pass
 
 - print("enter username")
 
 - print("|--------|")
 
 - print("|        |")
 
 - print("|--------|")
 
 - #toxy()
 
 - username = input()
 
 - print("hello,", username")
 
  复制代码 
2tkinter关闭窗口,这个只需要一行,就是root.xxx() 
root.quit()没用,它可能是推出主循环,但是代码里窗口关闭后还有其他代码 
 
不会没关系!
 本帖最后由 isdkz 于 2023-2-8 20:41 编辑 
先做第一题,第二题还没明白你意思,或者你是需要 root.destroy(), 
 
第一题也是 Mike 问了你我才知道你想干嘛  
 
- import ctypes
 
 - import os
 
 - os.system("cls")
 
  
- class COORD(ctypes.Structure):
 
 -          _fields_ = [("X", ctypes.c_short), ("Y", ctypes.c_short)] 
 
 -          def __init__(self,x,y):
 
 -                  self.X = x
 
 -                  self.Y = y
 
  
- def toxy(x, y):
 
 -     # 一些代码
 
 -     STD_OUTPUT_HANDLE= -11
 
 -     hOut = ctypes.windll.kernel32.GetStdHandle(STD_OUTPUT_HANDLE)
 
 -     INIT_POS=COORD(x,y)
 
 -     ctypes.windll.kernel32.SetConsoleCursorPosition(hOut,INIT_POS)
 
  
- print("enter username")
 
 - print("|--------|")
 
 - print("|        |")
 
 - print("|--------|")
 
 - toxy(1, 2)
 
 - username = input()
 
 - toxy(0, 5)
 
 - print("hello,", username)
 
 
  复制代码 
 
 
 |   
 
 
 
 |