Admin | Write | GuestBook
[공지] 해당 블로그에 용건이 있으신 분께서는 http://blog.fore.kr/ 의 방명록(Guestbook)으로 부탁드립니다.
gotoxy in windows python
Category : Programming/Programming Talk | URL : | Written by 포레 ( 2015. 8. 30. 22:50 ) | 신고

 

[ありがとうございます!!]

 

 

 

import ctypes


def gotoxy(x,y):
 return ctypes.windll.kernel32.SetConsoleCursorPosition(ctypes.windll.kernel32.GetStdHandle(-11),(((y&0xFFFF)<<0x10)|(x&0xFFFF)))

 

class CUSTOM_CONSOLE_SCREEN_BUFFER_INFO(ctypes.Structure):
 _fields_ = [ ('dwSize',ctypes.c_uint),
   ('dwCursorPosition',ctypes.c_uint),
   ('wAttributes',ctypes.c_ushort),
   ('srWindow',ctypes.c_ulonglong),
   ('dwMaximumWindowSize',ctypes.c_uint)
    ]

 

def GetConsoleCursorPos():
 ccsbi = CUSTOM_CONSOLE_SCREEN_BUFFER_INFO()
 ccsbi.dwSize = 0x16
 ctypes.windll.kernel32.GetConsoleScreenBufferInfo(ctypes.windll.kernel32.GetStdHandle(-11),ctypes.byref(ccsbi))
 pos = ccsbi.dwCursorPosition
 return (pos&0xFFFF), ((pos>>0x10)&0xFFFF)


 

 

일단 검색해서 제대로 안나오길래 어렵지 않을거 같아서 직접 구현함.

 

언젠가 또 이걸 찾을 날이 오겠지, 으 . . .

 

p.s > 왜 from ctypes import * 을 날리지 않았냐 라고 묻는다면

이렇게 길어질줄 몰랐다고 답하겠습니다.

 

Category
분류 전체보기 (605)
Notice (6)
Programming (79)
DISKER (1)
FSCH (7)
Caption (0)
Rest Time ! (443)
Hobby (64)
Tour (5)
Blind Post (0)
Recent Post
Recent Comment
Link
Calender
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Total :
Today :
Yesterday :