我的界面不显示带有cx\U冻结的日历

2024-04-25 08:46:37 发布

您现在位置:Python中文网/ 问答频道 /正文

我有个问题。我使用cx\u freeze使我的程序自治。 当我在计算机上执行程序时,没有问题,但当我冻结它时,我无法打开接口。 这个界面有两个日历(我使用模块tk.calendar) 我不明白为什么窗户里什么也看不见。我在生成文件夹中使用exe时没有错误

谢谢你的帮助

这里是顶层的代码行

# on importe les librairies dont nous avons besoins
import sqlite3
from tkinter import messagebox
import datetime
from lxml import etree
import tkinter as tk
from tkcalendar import Calendar
import csv


# on creer la classe pour l'interface
class AffichageExtraction:
    # ligne de code qui se lance lorsque de l'initialisation
    def __init__(self, fenetre_mere):
        date_brut = datetime.datetime.now()
        self.fenetre_extraction = tk.Toplevel(fenetre_mere)
        self.fenetre_extraction.title("Module d'extraction")
        # on creer des objetrs pour chaqu'une des interractions

    # on creer le widget calendrier
    self.DateDebut = Calendar(self.fenetre_extraction, font="Arial 14", selectmode='day', locale='fr_FR',
                              cursor="hand1", year=date_brut.year, month=date_brut.month, day=date_brut.day)

    self.DateFin = Calendar(self.fenetre_extraction, font="Arial 14", selectmode='day', locale='fr_FR',
                            cursor="hand1", year=date_brut.year, month=date_brut.month, day=date_brut.day)

    # on creer les libelle
    self.libelle_date_debut = tk.Label(self.fenetre_extraction, text="Date de début")
    self.libelle_date_fin = tk.Label(self.fenetre_extraction, text="Date de fin")
    self.libelle_spaceur = tk.Label(self.fenetre_extraction, text="    ")

    # on creer le bouton
    self.boutton_validation = tk.Button(self.fenetre_extraction, text="Exctraction ACTIP", command=self.ACTIp)
    self.boutton_csv = tk.Button(self.fenetre_extraction, text="Extraction en CSV", command=self.extraction_csv)

    self.libelle_date_debut.grid(row=0, column=1)
    self.DateDebut.grid(row=1, column=1)

    self.libelle_spaceur.grid(row=0, column=2)

    self.libelle_date_fin.grid(row=0, column=3)
    self.DateFin.grid(row=1, column=3)

    self.boutton_validation.grid(row=2, column=4)
    self.boutton_csv.grid(row=2, column=3)

这里是cx\u freeze的setup.py代码

import sys
from cx_Freeze import setup, Executable

base = None
if sys.platform == 'win32':
    base = 'Win32GUI'

options = {
    'build_exe': {
        'includes': 'atexit'
    }
}

executables = [
    Executable('BouclePrincipale.py', base="Win32GUI")
]

setup(name='simple_Tkinter',
      version='0.1',
      description='Sample cx_Freeze Tkinter script',
      executables=executables
      )

Tags: textimportselfdateoncolumntkgrid