Results 1 to 5 of 5

Thread: มีคำถาม python มาถามอีกแล้วครับ เกี่ยวกับ Tkinter ครับ

  1. #1
    Junior Member
    Join Date
    Apr 2006
    Location
    Thailand
    Posts
    15


    มีคำถาม python มาถามอีกแล้วครับ เกี่ยวกับ Tkinter ครับ

    คือตอนที่ผม run โปรแกรมนะครับแล้วผมใช้Tkinter ทำตัว interface แต่รันแล้ว มันมีหน้าจอเหมือน DOS ดำๆ ออกมาด้วยอะครับ จะเอายังไงเหรอครับ(เคยอ่านเจอครั้งหนึ่งแต่จำไม่ได้ว่าที่ไหน ช่วยบอกทีครับ) หุหุหุ ขอบคุงครับ

  2. #2
    Junior Member
    Join Date
    Apr 2006
    Location
    Thailand
    Posts
    15


    Re: มีคำถาม python มาถามอีกแล้วครับ เกี่ยวกับ Tkinter ครับ

    ไม่มีคนตอบเลย เอ๋หรือเราเขียนผิด จะเอาออกๆๆ >=( >=( >=(

  3. #3
    Administrator asylu3's Avatar
    Join Date
    Jun 2000
    Location
    Thailand
    Posts
    3,557


    Re: มีคำถาม python มาถามอีกแล้วครับ เกี่ยวกับ Tkinter ครับ

    pyInstaller
    pyInstaller is the reincarnation of McMillan Installer. It can also create one-file executables.
    You can get it from http://pyinstaller.hpcf.upr.edu/cgi-bin/trac.cgi/wiki

    Unzip pyInstaller in the pyinstaller_1.1 subdirectory, then do:


    Code:
    python pyinstaller_1.1Configure.py
    (You only have to do this once.)

    Then create the .spec file for your program:


    Code:
    python pyinstaller_1.1Makespec.py myprogram.py myprogram.spec
    Then pack your program:


    Code:
    python pyinstaller_1.1Build.py myprogram.spec
    You program will be available in the distmyprogram subdirectory. (myprogram.exe, pythonXX.dll, MSVCR71.dll, etc.)

    You have several options, such as:

    --onefile will create a single EXE file. E.g.:

    Code:
    python pyinstaller_1.1Makespec.py --onfile myprogram.py myprogram.spec
    Note that this EXE, when run, unpacks all files in a temporary directory, runs the unpacked program from there, then deletes all files when finished. You may or may not like this behaviour (I don't).
    --noconsole allows the creation of pure Windows executables (with no console window).

    Code:
    python pyinstaller_1.1Makespec.py --noconsole myprogram.py myprogram.spec
    --tk is a really nice option of pyInstaller which packs all necessary files for tkinter (tcl/tk).

    More at http://sebsauvage.net/python/snyppets/index.html

  4. #4
    Junior Member
    Join Date
    Apr 2006
    Location
    Thailand
    Posts
    15


    Re: มีคำถาม python มาถามอีกแล้วครับ เกี่ยวกับ Tkinter ครับ

    โอ้ ขอบคัณครับ ยุ่งยากเหมือนกันแหะ งึมๆ

  5. #5
    Senior Member
    Join Date
    Sep 2003
    Location
    Thailand
    Posts
    136


    Re: มีคำถาม python มาถามอีกแล้วครับ เกี่ยวกับ Tkinter ครับ

    ผมได้ฟังคำถามจากผู้ตั้งคำถาม..

    ผมยังไม่ทราบชัดว่าคำตอบจะแก้ได้อย่างไร ?
    แต่ความรู้ที่ผมมีอยู่คือ เคยรันโปรแกรม plone
    เคยดู shortcut ของ plone พบว่าไม่ใช่ไฟล์ .exe แต่กลับเป็นสคริปต์ไพธอน

    Plone เค้าใช้วิธีการเรียกโปรแกรมแบบนี้ครับ
    "C:Program FilesPlone 2Pythonpythonw.exe" "C:Program FilesPlone 2XControllerwxApp.py" "C:Program FilesPlone 2Data" "C:Program FilesPlone 2Zopelibpython"

    วิเคราะห์
    1. แบ่งมันออกเป็นส่วน มี 4 ส่วนคือ
    "C:Program FilesPlone 2Pythonpythonw.exe"
    "C:Program FilesPlone 2XControllerwxApp.py"
    "C:Program FilesPlone 2Data"
    "C:Program FilesPlone 2Zopelibpython"

    - ความรู้ที่เกิดขึ้นคือ เค้าเรียกใช้ pythonw.exe แทนที่จะใช้ python.exe ที่พวกเราเข้าใจ !!
    - ส่วนไฟล์ .py ใช้เป็นอาร์กิวเมนต์ให้ pythonw.exe เท่านั้น
    - ไฟล์ที่เหลือเป็นอาร์กิวเมนต์ที่จะใช้ร่วมกับ wxApp.py เราไม่ต้องสนใจ

    ดังนั้น จากปัญหาของผู้ตั้งกระทู้ สามารถแก้ไขได้ดังนี้
    1. ติดตั้ง python
    2. ติดตั้ง wxPython
    3. สร้างซอร์สโค๊ดของตัวเอง เช่น สมมติว่าบันทึกไว้ใน c:temptest.py
    from wxPython.wx import *

    class MyApp(wxApp):
    def OnInit(self):
    frame = wxFrame(NULL, -1, "Hello from wxPython")
    frame.Show(true)
    self.SetTopWindow(frame)
    return true

    app = MyApp(0)
    app.MainLoop()

    4. เรียกใช้คำสั่ง (ตั้งเป็น shortcut) กำหนด target (ในช่อง property) ดังนี้
    "C:devpythonpythonw.exe" "C:temptest.py"

    โปรแกรมสามารถทำงานได้อย่างสมบูรณ์ ครับ !!
    http://202.28.33.44

Similar Threads

  1. เกี่ยวกับ การยิง ip camfrog ครับ
    By pingtana in forum Ethical Hacking for Padawan
    Replies: 2
    Last Post: 11-05-2010, 10:03 PM
  2. เกี่ยวกับ ARP ครับ
    By WC_{Sky} in forum OS & Networking
    Replies: 3
    Last Post: 30-04-2010, 08:11 PM
  3. e book เกี่ยวกับ SSL ครับ
    By tanpisito in forum E-Book, Video หรือบทความทั่วไปด้าน Computer
    Replies: 0
    Last Post: 20-09-2007, 05:05 PM
  4. Replies: 1
    Last Post: 28-08-2007, 01:22 PM
  5. เกี่ยวกับ Cygwin ครับ
    By A89z Seriez in forum C/C++,C#,VC++,MFC,Win32
    Replies: 1
    Last Post: 03-10-2005, 12:18 PM

Members who have read this thread : 0

Actions : (View-Readers)

There are no names to display.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •