홈>
AAAAAAA 텍스트를 한 창에 인쇄하고 BBBBBBB를 다른 창에 인쇄하고 싶지만 캔버스를 사용하여 어떻게합니까?
from tkinter import*
root = Tk()
canvas = Canvas(root)
canvas.pack(fill=BOTH, expand=1) # Stretch canvas to root window size.
root.wm_geometry("794x370")
root.title('Map')
def toplevel():
top = Toplevel()
top.title('Optimized Map')
top.wm_geometry("794x370")
optimized_canvas = Canvas(top)
optimized_canvas.pack(fill=BOTH, expand=1)
toplevel()
l0 = Label(canvas, text="AAAAAAA", font= "calibri 32 bold",bg="white" )
canvas.create_window(0,70, window=l0, anchor=NW)
l1 = Label(canvas, text="BBBBBBB", font= "calibri 32 bold",bg="white" )
canvas.create_window(0,70, window=l1, anchor=NW)
root.mainloop()
- 답변 # 1
관련 자료
- Windows 커널 드라이버가 DebugView로 인쇄 할 수 없음
- c# - net core 31 Windows 서비스에서 문서를 인쇄 할 수 있습니까?
- javascript - css - 인쇄 캔버스 정의
- bash - 빈 필드가없고없는 모든 행을 별도의 파일로 인쇄
- c++ - 응용 프로그램 레이블을 Windows에서 인쇄하는 방법
- c++ - 텍스트 파일을 한 줄씩 인쇄하고 올바르게 분리하는 방법은 무엇입니까?
- .net - Bluetooth를 사용하여 Windows Pocket PC에서 PRINT 명령을 실행하는 방법 (C #)
- sql server - T-SQL 쿼리가 별도의 창에서 다르게 반환되는 이유는 무엇입니까?
- windbg - windows - ci 테스트 중 코어 덤프의 경우 스택 추적 인쇄
- node.js - windows nodejs child_process exec echo 항상 childProcess 인스턴스를 인쇄합니다
- c - Windows에서 \ n을 인쇄하는 방법?
관련 질문
- python : 모든 Treeview 항목을 sqlite3 데이터베이스에 삽입하는 방법
- python : tkinter에서 두 개의 숫자를 추가하는 방법
- python : Tkinter 그리드 행 크기 조정 중지
- python : RuntimeError: 스레드 'Thread-7'에 현재 이벤트 루프가 없습니다. discord.py와 함께
- python : 다른 dtypes로 값 곱하기
- python : 프레임이 캔버스 자체보다 작을 때 스크롤 가능한 상위 캔버스 전체를 차지하도록 설정
- python : TopLevel 위젯을 사용하여 Tkinter GUI 양식 구현
- python : 프레임을 사용하지 않고 Tkinter 부드러운 창 변경
- python : label.config로 인해 스레드가 결합되지 않음
- python : tkinter 업로드 이미지 및 로컬 디렉토리에 저장
optimized_canvas
사용 두 번째 라벨 포함함수로 캔버스를 생성하면 캔버스가 로컬 변수에 할당되고이를 사용하려면 외부/전역 변수에 할당해야합니다.