head first java programming phần 7

Bạn cần phải thiết kế giao diện của giao diện của bạn cho TVN. Vẽ những gì bạn nghĩ giao diện của bạn sẽ giống như trong không gian được cung cấp dưới đây. Gợi ý: Hãy dành một chút thời gian để suy nghĩ về các chương trình khác giao diện mà bạn đã sử dụng. Hãy suy nghĩ về một yếu tố giao diện phổ biến mà bạn có thể sử dụng (và vẽ) ở đây. | building a graphical user interface You need to design the look of your GUI for TVN. Draw what you think your GUI should look like in the space provided below. Hint Take some time to think about other GUI programs that you have used. Think about a common interface element that you could use and draw here. you are here 4 231 interface facelift 232 Chapter 7 building a graphical user interface Frank Since when have you been an expert on GUIs Jim Isn t every Windows user Joe Well of course everyone knows how to use a GUI but we are talking about creating a GUI in code. Jim Ah. oh. um. eh. now where shall we start Frank It turns out that writing code for a GUI application is. well. just like writing any other code. If you know how to program you know how to create a GUI. It s just a matter of selecting the correct GUI library learning how to use it then writing the code. Joe So we ll head off to the Python Package Index and grab us some GUI libraries eh Frank Not so fast. Python comes with a GUI library as standard called tkinter. Jim tk-what Frank tkinter. The tk bit refers to the fact that Python s standard GUI library is built on top of the very popular Tk technology. The inter bit is short for interface. Jim So we re going to build a GUI interface in Python running on Tk using tkinter Frank Yes we are. That s not too confusing is it Joe Jim Well. not if you say so. Frank The big thing with creating GUIs is understanding the event loop. Joe Ah that s just looping code that reacts when certain things happen isn t it It s just like the while loop in the non-GUI version of TVN s program. In that code that loop is an event loop isn t it Frank It sure is. Although the GUI event loop tends to be extra capable and can do lots more than the simple while loop. Joe That sounds complex. Is it Frank No not really. It just takes a little getting used to. Jim But it s all just code isn t it Frank Yes Python code using the tkinter library. Joe OK. Let s get to it since we already

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
34    443    5    24-05-2024
202    1    1    24-05-2024
24    72    2    24-05-2024
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.