以下代码
from tkinter import *
window=Tk()
lbl=Label(window,width='30',height='15',relief='solid')
lbl.pack()
window.mainloop()
生成this
是否有办法仅在一侧移除边框?
答案 0 :(得分:1)
在Q / A here上使用示例(我会将其作为一个重复的问题链接到它,但需要一些tweeking来与此OP的问题进行比较。)
我们可以创建看起来像带有三边和一边没有边框的标签。
if(command === '!music') {
var link = arg1
console.log(link)
const ytdl = require('ytdl-core');
const streamOptions = { seek: 0, volume: 1 };
const broadcast = bot.createVoiceBroadcast();
if(link === undefined) {
bot.guilds.get(guildid).channels.get(generalchan).send("You need to put a link after !music to put a song in the queue")
} else {
if (message.member.voiceChannel) {
message.member.voiceChannel.join()
.then(connection => { // Connection is an instance of VoiceConnection
message.reply('SONG : ' + link);
const streamOptions = { seek: 0, volume: arg2/100, filter : "audioonly" };
connection.playStream(ytdl(link), streamOptions);
})
} else {
message.reply("You need to be in a voice channel for me to join")
}
}
}'
结果:
答案 1 :(得分:0)
如果我使用Canvas而不是Label,我可以通过边创建线条在三面制作边框。 示例代码:
from tkinter import *
root=Tk()
canvas=Canvas(height='250',width ='250')
canvas.create_line(251,0,251,251,width=2,fill='black')
canvas.create_line(3,3,251,3,width=2,fill='black')
canvas.create_line(3,251,252,251,width=2,fill='black')
canvas.pack()
root.mainloop()
哪个输出this
可能会有更实际的方法。