在我的应用程序中,我试图将我的按钮、文本和输入放在窗口的中心。我使用PySimpleGUI来设计按钮。为了对齐中心,我justification='center'在我的代码中使用了属性。但它仍然不适合中心窗户。
正在使用的代码是
import PySimpleGUI as sg
from tkinter import *
sg.theme('DarkAmber')
layout = [
[sg.Text('Enter the value',justification='center')],
[sg.Input(justification='center')],
[sg.Button('Enter','center')]
]
window = sg.Window('My new window', layout, size=(500,300), grab_anywhere=True)
while True:
event, values = window.read() # Read the event that happened and the values dictionary
print(event, values)
if event == sg.WIN_CLOSED or event == 'Exit': # If user closed window with X or if user clicked "Exit" button then exit
break
if event == 'Button': …Run Code Online (Sandbox Code Playgroud) 在C编程中,我已经了解file io并运行了以下示例代码:
#include <stdio.h>
main()
{
FILE *fp;
fp = fopen("E:\\tmp\bae.txt", "w+");
fprintf(fp, "This is testing for fprintf...\n");
fputs("This is testing for fputs...\n", fp);
fclose(fp);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
这里代码工作正常并fputs()返回-1,这意味着代码工作正常.我tmp在E:驱动器上创建了一个目录,但是这段代码没有创建文件bae.txt..'
谁能告诉我为什么会这样?