Automatically translated.View original post

html + css and tkinter are different..???

# Pythonprogramming # Lemon 8 Howtoo # ui

If you compare the HTML + CSS UI and Tkinter, it's as simple as choosing a home-building tool. On one side, it's like a Lego connection that modifies colorful shapes without limits. On the other, it's like using a finished toolbox that's sensitive and practical on a computer. This is a clear summary of the differences.: 1. Core Concept HTML + CSS: is the world standard for creating a Web User Interface. HTML is used to build a (bone-like) structure, and CSS is used to decorate faces (like clothes and looks). It often works with JavaScript to achieve fluidity. Tkinter: It is a library, a standard attached to the Python language for creating a Desktop GUI (Graphical User Interface) or a window program that runs on a particular computer 2. Boxing-to-Boxing Comparison Table / Features UI HTML + CSSTkinter (Python), the main web browser (Chrome, Safari), and some mobile / desktop apps, computer-based applications (Windows, macOS, Linux), very high design flexibility, customize animation, shadows, translucency, or arrange complex layouts quite limited. The face is classic / ancient (but modern with CustomTkinter), difficult-to-learn, easy at first, but requires learning multiple technologies in tandem (HTML, CSS, JS). Easy for people with a Python background. Write code to finish in a single file, connect. With computer systems, limited (attached to the Sandbox browser security system), deep access to local files, hardware management, or running backyard scripts at the speed of development, more time than it takes to provide a page to support every screen (Responsive), write a few lines of code, buttons, windows are available immediately 3. Dig into the differences in how the screen is arranged (Layout) HTML + CSS: Use very powerful systems like Flexbox and CSS Grid, making it perfect to shrink the screen according to computer or mobile size. Tkinter: Use three major window management systems: pack () (paste), grid (paste), and place () (specify X, Y coordinates). If the window is expanded, sometimes the face can be distorted more easily if not calculated. Appearance HTML + CSS: Can make beautiful, advanced, or shiny effects of any size. Tkinter: Default looks like a Windows 98 / XP-era program, but there is currently a team of developers making customTkinter add-ons that help keep the buttons rounded and support Dark Mode, which solves a lot of clumsiness weaknesses. What should I use? Select the HTML + CSS UI when: you want to make a website or web application that people can access through links. You want a beautiful, modern, unique design. You want to support both computer and mobile activation. Choose Tkinter when: You already write Python and want to create a simple GUI window for users to click instead of typing in the terminal. Make your own application in the enterprise, compute, file manager or connect to a Hardwares / IoT device. It does not emphasize beauty, but focuses on speed of development. Write and run as a .exe file. What kind of project are you planning to develop? You can tell me. You can suggest which tool will be best suited.

5/31 Edited to

... Read moreเมื่อผมเริ่มต้นทำโปรเจกต์เกี่ยวกับ UI ด้วย Python ส่วนตัวผมรู้สึกได้ชัดเลยว่าการเลือกใช้ Tkinter หรือ HTML+CSS ขึ้นอยู่กับเป้าหมายและประเภทของโปรเจกต์ที่อยากสร้าง ในประสบการณ์ตรงนั้น ผมพบว่า Tkinter เหมาะกับงานที่ต้องการความรวดเร็ว สามารถเขียนโค้ดเสร็จในไฟล์เดียวและเรียกใช้งานได้ทันที เช่น โปรแกรมเครื่องมือเล็กๆ ภายในองค์กร หรือแอปพลิเคชันที่ต้องจัดการไฟล์หรือฮาร์ดแวร์ในเครื่องโดยตรง ผมเองเคยใช้ CustomTkinter ที่ช่วยให้ UI ดูทันสมัยขึ้น มีปุ่มโค้งมนและรองรับ Dark Mode ซึ่งทำให้หน้าตาไม่ล้าสมัยเหมือนเดิม แต่ถ้าอยากทำเว็บที่ดูสวยงาม มีเอฟเฟกต์แสงเงาหรือแอนิเมชัน ผมแนะนำให้ใช้ HTML+CSS เพราะเครื่องมือนี้ยืดหยุ่นสูงและรองรับการใช้งานหลากหลายแพลตฟอร์มผ่านเว็บบราวเซอร์ อีกทั้ง CSS Grid และ Flexbox ก็ช่วยให้การจัดวาง Layout มีความยืดหยุ่นรองรับทุกขนาดหน้าจอ ทำให้เว็บไซต์สามารถใช้งานได้ดีทั้งบนเดสก์ท็อปและมือถือ ผมเองยังเคยเจอข้อจำกัดของ Tkinter คือถ้าไม่วาง Layout ดีๆ จะเจอปัญหาหน้าต่างเบี้ยวเมื่อขยายหน้าต่าง แต่ถ้าใช้ HTML+CSS ปัญหานี้จะน้อยลงมาก เพราะมีระบบจัดการ Layout ที่ซับซ้อนกว่าและดีไซน์สามารถปรับเปลี่ยนได้ง่ายตามขนาดหน้าจอ สุดท้ายนี้ ผมคิดว่าการเลือกใช้ต้องดูที่เป้าหมายของโปรเจกต์ เช่น ถ้าต้องการพัฒนาโปรแกรมเดสก์ท็อปที่เชื่อมต่อกับฮาร์ดแวร์ หรือรันโค้ด Python ได้ลึก Tkinter จะเหมาะสมกว่า แต่ถ้าเป้าหมายคือเว็บแอปที่ต้องการดีไซน์และความสวยงาม ขอแนะนำ HTML+CSS ถ้าใครกำลังลังเลอยู่ว่าควรเริ่มจากอะไร ลองดูว่าคุณถนัดภาษาไหน ชอบทำงานในรูปแบบไหน แล้วค่อยเลือกเครื่องมือที่ใช่สำหรับคุณครับ