簡體   English   中英

GUI窗口未按指示調整大小

[英]GUI Window Does Not Resize as indicated

我在面板上設置了大小,但是在運行程序時它不起作用。 它只是彈出很小,我必須手動調整大小。

我嘗試設置/初始化框架,但是當我這樣做時,它將阻止任何輸入。 所以我不能再使用我的程序。 我也嘗試過無數次在面板設置中進行設置。

class CipherTexter(wx.Panel):
def __init__(self, parent):
    wx.Panel.__init__(self, parent, size=(5000, 5000))
    #wx.Frame.__init__(self, parent,  size=(5000, 5000))
    self.cipherText = wx.StaticText(self, label="Cipher Texter ", pos=(20, 30))

app = wx.App(False)
frame = wx.Frame(None, wx.ID_ANY, "The SS Cipher")
panel = CipherTexter(frame)
frame.Show()
app.MainLoop()  

當我第一次打開應用程序時,我得到了。 我希望能夠看到整個內容,而不必手動調整大小。 在此處輸入圖片說明

嘗試將“面板”放入“框架”中。
我想這是您要求的起點的模型。

import wx

class CipherTexter(wx.Frame):
    def __init__(self, parent, title):
        wx.Frame.__init__(self, parent, title=title,  size=(1000, 600))
        self.panel = wx.Panel(self)
        cipherText = wx.StaticText(self.panel, label="Cipher Texter ", pos=(20, 30))
        encryptorText = wx.StaticText(self.panel, label="Encryptor ", pos=(20, 70))
        decryptorText = wx.StaticText(self.panel, label="Decryptor ", pos=(20, 100))
        self.cipher = wx.TextCtrl(self.panel, -1, style=wx.TE_MULTILINE, size=(400,400), pos=(400, 30))
        self.encryptor = wx.TextCtrl(self.panel, -1, size=(100,30), pos=(200, 70))
        self.decryptor = wx.TextCtrl(self.panel, -1, size=(100,30), pos=(200, 100))
        self.encrypt = wx.Button(self.panel, -1, "Encrypt", pos=(20, 140))
        self.decrypt = wx.Button(self.panel, -1, "Decrypt", pos=(20, 180))
        self.panel.SetBackgroundColour('white')
        self.encrypt.Bind(wx.EVT_BUTTON, self.encryptNow)
        self.decrypt.Bind(wx.EVT_BUTTON, self.decryptNow)
        self.Show()

    def encryptNow(self, event):
        print("Encrypting")
        cipher = self.cipher.GetValue()
        encryptor = self.encryptor.GetValue()
        print(cipher)
        print("with ", encryptor)

    def decryptNow(self, event):
        print("De-Encrypting")
        cipher = self.cipher.GetValue()
        decryptor = self.decryptor.GetValue()
        print(cipher)
        print("with ", decryptor)

app = wx.App(False)
frame = CipherTexter(None, "The SS Cipher")
app.MainLoop()

在此處輸入圖片說明

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM